Default404PageTest.php 658 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. class Default404PageTest extends PHPUnit_Framework_TestCase
  3. {
  4. private $testObj;
  5. private $twig;
  6. public function setUp()
  7. {
  8. $this->twig = $this->getMockBuilder('TwigWrapper')
  9. ->disableOriginalConstructor()
  10. ->getMock();
  11. $this->testObj = new Default404Page($this->twig);
  12. }
  13. public function tearDown()
  14. {
  15. }
  16. public function testDisplayDisplaysThe404Template()
  17. {
  18. $expected = TestUtils::getRandomString(20);
  19. $this->twig->expects($this->once())
  20. ->method('render')
  21. ->with('404page.html', array())
  22. ->willReturn($expected);
  23. // train mock
  24. $actual = $this->testObj->display();
  25. $this->assertEquals($expected, $actual);
  26. }
  27. }