OSDN Git Service

- [merged] IDEAS/Ideas_Extended_Viewclass branch with trunk.
[ethna/ethna.git] / test / View / Ethna_View_404_Test.php
1 <?php
2 /**
3  *  Ethna_View_404_Test.php
4  *
5  *  @author     Yoshinari Takaoka <takaoka@beatcraft.com>
6  *  @version    $Id$
7  */
8
9 require_once ETHNA_INSTALL_BASE . '/test/Ethna_MockProject.php';
10
11 //{{{    Ethna_View_404_Test
12 /**
13  *  Test Case For Ethna_View_404
14  *
15  *  @access public
16  */
17 class Ethna_View_404_Test extends Ethna_UnitTestBase
18 {
19     var $test_ctl;
20     var $test_backend;
21     var $view_404;
22
23     function setUp()
24     {
25         $this->test_ctl =& new Ethna_Controller();
26         $this->test_backend =& $this->test_ctl->getBackend();
27         $this->view_404 = new Ethna_View_404($this->test_backend, '404', NULL);
28     }
29
30     function tearDown()
31     {
32         unset($GLOBALS['_Ethna_controller']);
33     }
34
35     function test_redirect_404()
36     {
37         $project =& new Ethna_MockProject();
38         $project->create();
39
40         //   add mock action for redirect
41         $action_skel = ETHNA_TEST_SKELDIR . 'skel.action.404.php';   
42         $project->runCmd('add-action',
43                          array(
44                              '-s', $action_skel,
45                              'return404',
46                          )
47         );
48
49         $out = $project->runMain('return404');
50         $this->assertPattern("/404 Not Found/", $out); 
51     }
52 }