Example #1
0
<?php

require_once '_HelpersUnitTester.php';
require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . 'capture_helper.php';
require_once AK_LIB_DIR . DS . 'AkActionView.php';
require_once AK_LIB_DIR . DS . 'AkActionController.php';
require_once AK_LIB_DIR . DS . 'AkRequest.php';
ak_generate_mock('AkRequest');
class CaptureHelperTests extends HelpersUnitTester
{
    function setUp()
    {
        $this->controller =& new AkActionController();
        $this->controller->Request =& new MockAkRequest($this);
        $this->controller->controller_name = 'test';
        $this->controller->instantiateHelpers();
        $this->capture_helper =& $this->controller->capture_helper;
    }
    function test_begin_without_label()
    {
        $str = "test CaptureHelper #1";
        $this->capture_helper->begin();
        echo $str;
        $this->assertEqual($this->capture_helper->end(), $str);
        $globals = AkActionView::_getGlobals();
        $this->assertEqual(isset($globals['content_for_']) ? $globals['content_for_'] : null, null);
    }
    function test_begin_with_label()
    {
        $str = "test CaptureHelper #2";
        $this->capture_helper->begin('test_2');
Example #2
0
<?php

include_once(AK_LIB_DIR.DS.'AkLocalize'.DS.'AkTimeZone.php');

class AkTestTime { function now(){} }
ak_generate_mock('AkTestTime');


class TimeZoneTestCase extends AkUnitTest
{
    public function setup()
    {
        $this->MockTime = new MockAkTestTime($this);
        $this->MockTime->setReturnValue('now','Sun Jul 25 14:49:00 UTC 2004');
        $this->timestamp = gmmktime(14,49,00,7,25,2004);
    }

    public function test_should_return_positive_formatted_offset()
    {
        $zone = $this->_createTimeZone("Test", 4200);
        $this->assertEqual("+01:10", $zone->getFormattedOffset());
    }

    public function test_should_return_negative_formatted_offset()
    {
        $zone = $this->_createTimeZone("Test", -4200);
        $this->assertEqual("-01:10", $zone->getFormattedOffset());
    }

    public function test_now()
    {