Пример #1
0
 /**
  * Test the isAction method.
  *
  * @return void
  */
 public function testIsAction()
 {
     $request = new Request('/');
     $response = $this->getMock('Cake\\Network\\Response');
     $controller = new TestController($request, $response);
     $this->assertFalse($controller->isAction('redirect'));
     $this->assertFalse($controller->isAction('beforeFilter'));
     $this->assertTrue($controller->isAction('index'));
 }
Пример #2
0
 /**
  * Test declared deprecated properties like $theme are properly passed to view.
  *
  * @return void
  */
 public function testDeclaredDeprecatedProperty()
 {
     $controller = new TestController(new Request(), new Response());
     $theme = $controller->theme;
     // @codingStandardsIgnoreStart
     $this->assertEquals($theme, @$controller->createView()->theme);
     // @codingStandardsIgnoreEnd
 }
Пример #3
0
 /**
  * Test adding a component
  *
  * @return void
  */
 public function testAddComponent()
 {
     $request = new Request('/');
     $response = $this->getMock('Cake\\Network\\Response');
     $controller = new TestController($request, $response);
     $result = $controller->addComponent('Paginator');
     $this->assertInstanceOf('Cake\\Controller\\Component\\PaginatorComponent', $result);
     $this->assertSame($result, $controller->Paginator);
     $registry = $controller->components();
     $this->assertTrue(isset($registry->Paginator));
 }