3 require_once('_HelpersUnitTester.php');
4 require_once(AK_LIB_DIR
.DS
.'AkActionView'.DS
.'helpers'.DS
.'capture_helper.php');
5 require_once(AK_LIB_DIR
.DS
.'AkActionView.php');
6 require_once(AK_LIB_DIR
.DS
.'AkActionController.php');
7 require_once(AK_LIB_DIR
.DS
.'AkRequest.php');
9 ak_generate_mock('AkRequest');
12 class CaptureHelperTests
extends HelpersUnitTester
16 $this->controller
= &new AkActionController();
17 $this->controller
->Request
=& new MockAkRequest($this);
18 $this->controller
->controller_name
= 'test';
19 $this->controller
->instantiateHelpers();
21 $this->capture_helper
=& $this->controller
->capture_helper
;
24 function test_begin_without_label()
26 $str = "test CaptureHelper #1";
27 $this->capture_helper
->begin();
29 $this->assertEqual($this->capture_helper
->end(), $str);
30 $globals = AkActionView
::_getGlobals();
31 $this->assertEqual(isset($globals['content_for_']) ?
$globals['content_for_'] : null, null);
34 function test_begin_with_label()
36 $str = "test CaptureHelper #2";
37 $this->capture_helper
->begin('test_2');
39 $this->assertEqual($this->capture_helper
->end(), $str);
40 $globals = AkActionView
::_getGlobals();
41 $this->assertEqual($globals['content_for_test_2'], $str);
44 function test_content_for()
46 $str = "test CaptureHelper content_for";
47 $this->capture_helper
->content_for('content_for');
49 $this->assertEqual($this->capture_helper
->end(), $str);
50 $globals = AkActionView
::_getGlobals();
51 $this->assertEqual($globals['content_for_content_for'], $str);
56 ak_test('CaptureHelperTests');