Skip to content

Commit 0ec655d

Browse files
committed
Finish the ResourcePresenter testing
1 parent 3005744 commit 0ec655d

2 files changed

Lines changed: 29 additions & 4 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
namespace Tests\Support\RESTful;
3+
4+
use CodeIgniter\RESTful\ResourcePresenter;
5+
6+
class MockResourcePresenter extends ResourcePresenter
7+
{
8+
9+
public function getModel()
10+
{
11+
return $this->model;
12+
}
13+
14+
public function getModelName()
15+
{
16+
return $this->modelName;
17+
}
18+
19+
public function getFormat()
20+
{
21+
return $this->format;
22+
}
23+
24+
}

tests/system/RESTful/ResourcePresenterTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,16 +209,17 @@ public function testResourceUpdate()
209209
}
210210

211211
//--------------------------------------------------------------------
212+
212213
public function testModel()
213214
{
214-
$resource = new \Tests\Support\RESTful\MockResourceController();
215+
$resource = new \Tests\Support\RESTful\MockResourcePresenter();
215216
$this->assertEmpty($resource->getModel());
216217
$this->assertEmpty($resource->getModelName());
217218
}
218219

219220
public function testModelBogus()
220221
{
221-
$resource = new \Tests\Support\RESTful\MockResourceController();
222+
$resource = new \Tests\Support\RESTful\MockResourcePresenter();
222223

223224
$resource->setModel('Something');
224225
$this->assertEmpty($resource->getModel());
@@ -227,15 +228,15 @@ public function testModelBogus()
227228

228229
public function testModelByName()
229230
{
230-
$resource = new \Tests\Support\RESTful\MockResourceController();
231+
$resource = new \Tests\Support\RESTful\MockResourcePresenter();
231232
$resource->setModel('\Tests\Support\Models\UserModel');
232233
$this->assertInstanceOf('CodeIgniter\Model', $resource->getModel());
233234
$this->assertEquals('\Tests\Support\Models\UserModel', $resource->getModelName());
234235
}
235236

236237
public function testModelByObject()
237238
{
238-
$resource = new \Tests\Support\RESTful\MockResourceController();
239+
$resource = new \Tests\Support\RESTful\MockResourcePresenter();
239240
$model = new \Tests\Support\Models\UserModel();
240241
$resource->setModel($model);
241242
$this->assertInstanceOf('CodeIgniter\Model', $resource->getModel());

0 commit comments

Comments
 (0)