15479603
Alex Savenko
initialize
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
namespace PhalconRest\Test\Unit\Api;
use App\Model\Album;
use App\Transformers\AlbumTransformer;
use PhalconRest\Api\Resource;
class ResourceTest extends \Codeception\TestCase\Test {
/** @var Resource */
protected $resource;
protected function _before() {
$this->resource = Resource::factory('/albums')
->model(Album::class)
->transformer(AlbumTransformer::class)
->itemKey('album')
->collectionKey('albums');
}
public function testModel() {
$this->assertEquals($this->resource->getModel(), Album::class);
}
public function testTransformer() {
$this->assertEquals($this->resource->getTransformer(), AlbumTransformer::class);
}
public function testItemKey() {
$this->assertEquals($this->resource->getItemKey(), 'album');
}
public function testCollectionKey() {
$this->assertEquals($this->resource->getCollectionKey(), 'albums');
}
}
|