-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |