Skip to content

Commit bd50c23

Browse files
committed
Remove old test code, test non API paginated request early return
1 parent 0aae12d commit bd50c23

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

tests/ApiPaginationComponentTest.php

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Cake\Controller\ComponentRegistry;
66
use Cake\Controller\Controller;
77
use Cake\Core\Plugin;
8+
use Cake\Event\Event;
89
use Cake\Network\Request;
910
use Cake\Network\Response;
1011
use Cake\TestSuite\TestCase;
@@ -32,26 +33,16 @@ public function setUp()
3233
public function tearDown()
3334
{
3435
parent::tearDown();
35-
36-
unset($this->component, $this->controller);
3736
}
3837

39-
public function testInit()
38+
public function testNonApiPaginatedRequest()
4039
{
4140
$request = new Request('/');
4241
$response = $this->getMock('Cake\Network\Response');
43-
4442
$controller = new Controller($request, $response);
45-
$controller->loadComponent('BryanCrowe/ApiPagination.ApiPagination');
46-
47-
$expected = [
48-
'key' => 'pagination',
49-
'aliases' => [],
50-
'visible' => []
51-
];
52-
53-
$result = $controller->ApiPagination->config();
43+
$apiPaginationComponent = new ApiPaginationComponent($controller->components());
44+
$event = new Event('Controller.beforeRender', $controller);
5445

55-
$this->assertSame($expected, $result);
46+
$this->assertNull($apiPaginationComponent->beforeRender($event));
5647
}
5748
}

0 commit comments

Comments
 (0)