44use BryanCrowe \ApiPagination \Controller \Component \ApiPaginationComponent ;
55use Cake \Controller \ComponentRegistry ;
66use Cake \Controller \Controller ;
7+ use Cake \Core \Plugin ;
78use Cake \Network \Request ;
89use Cake \Network \Response ;
910use Cake \TestSuite \TestCase ;
11+ use PHPUnit_Framework_Assert ;
12+
1013
1114/**
1215 * ApiPaginationComponentTest class
1316 */
1417class ApiPaginationComponentTest extends TestCase
1518{
16- public $ component = null ;
17- public $ controller = null ;
18-
1919 /**
2020 * setUp method
2121 *
@@ -24,12 +24,6 @@ class ApiPaginationComponentTest extends TestCase
2424 public function setUp ()
2525 {
2626 parent ::setUp ();
27-
28- $ request = new Request ();
29- $ response = new Response ();
30- $ this ->controller = new Controller ($ request , $ response );
31- $ registry = new ComponentRegistry ($ this ->controller );
32- $ this ->component = new ApiPaginationComponent ($ registry );
3327 }
3428
3529 /**
@@ -43,4 +37,21 @@ public function tearDown()
4337
4438 unset($ this ->component , $ this ->controller );
4539 }
40+
41+ public function testInit ()
42+ {
43+ $ request = new Request ('/ ' );
44+ $ response = $ this ->getMock ('Cake\Network\Response ' );
45+
46+ $ controller = new Controller ($ request , $ response );
47+ $ controller ->loadComponent ('BryanCrowe/ApiPagination.ApiPagination ' );
48+
49+ $ expected = [
50+ 'key ' => 'pagination ' ,
51+ 'aliases ' => [],
52+ 'visible ' => []
53+ ];
54+
55+ $ this ->assertSame ($ expected , $ controller ->ApiPagination ->config ());
56+ }
4657}
0 commit comments