Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Jan 28, 2024
1 parent a1769cd commit 80d0d9c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
44 changes: 44 additions & 0 deletions tests/Resources/ResourceTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace Cone\Root\Tests\Resources;

use Cone\Root\Tests\TestCase;
use Cone\Root\Tests\User;

class ResourceTest extends TestCase
{
protected UserResource $resource;

public function setUp(): void
{
parent::setUp();

$this->resource = new UserResource();
}

public function test_a_resource_resolves_model(): void
{
$this->assertSame(User::class, $this->resource->getModel());
$this->assertInstanceOf(User::class, $this->resource->getModelInstance());
}

public function test_a_resource_has_keys(): void
{
$this->assertSame('users', $this->resource->getKey());
$this->assertSame('users', $this->resource->getUriKey());
$this->assertSame('_resource', $this->resource->getRouteParameterName());
}

public function test_a_resource_has_names(): void
{
$this->assertSame('Users', $this->resource->getName());
$this->assertSame('User', $this->resource->getModelName());
}

public function test_a_resource_has_icon(): void
{
$this->assertSame('archive', $this->resource->getIcon());
$this->resource->icon('users');
$this->assertSame('users', $this->resource->getIcon());
}
}
11 changes: 11 additions & 0 deletions tests/Resources/UserResource.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Cone\Root\Tests\Resources;

use Cone\Root\Resources\Resource;
use Cone\Root\Tests\User;

class UserResource extends Resource
{
protected string $model = User::class;
}

0 comments on commit 80d0d9c

Please sign in to comment.