public function testPrevCurrentNext() { $request = new RequestAggregate(); $controller = new UsersController($request); $controller->initialize(); $request->setRequest(new Param('/Users/page')); $request->setRequest(new Query([])); $controller->Paginator->paginate(); $view = new ViewAdapter('../../app/View', '../../app/Layout', $controller); //current = 1 $this->assertEquals(null, $view->Paginator->prev('prev')); $this->assertEquals(1, $view->Paginator->current()); $this->assertEquals("<a href='/Users/page/?page=2'>next</a>", $view->Paginator->next('next')); $request->setRequest(new Query(['page' => 1])); $controller->Paginator->paginate(); //current = 1 $this->assertEquals(null, $view->Paginator->prev('prev')); $this->assertEquals(1, $view->Paginator->current()); $this->assertEquals("<a href='/Users/page/?page=2'>next</a>", $view->Paginator->next('next')); $request->setRequest(new Query(['page' => 2])); $controller->Paginator->paginate(); //current = 1 $this->assertEquals("<a href='/Users/page/?page=1'>prev</a>", $view->Paginator->prev('prev')); $this->assertEquals(2, $view->Paginator->current()); $this->assertEquals(null, $view->Paginator->next('next')); }
public function testLoadComponent() { $request = new RequestAggregate(); $request->setRequest(new Param('/Mocks/index/1')); $controller = new UsersController($request); $controller->initialize(); $this->assertInstanceOf('MockComponent', $controller->Mock); $this->assertEquals('success', $controller->Mock->startup()); }