Implemented the update-command in scripts/plugin. 'install' complains now about an...
[akelos.git] / test / unit / lib / utils / _Ak_support_functions.php
blob24451d303d0038905ac15d0cb1c1fad3a41f6d8b
1 <?php
3 require_once(dirname(__FILE__).'/../../../fixtures/config/config.php');
4 require_once(AK_LIB_DIR.DS.'Ak.php');
6 class test_Ak_support_functions extends AkUnitTest
8 function test_for_importing_models()
10 $models = 'ImportTestModelA, import_test_model_b';
12 $this->assertFalse(class_exists('ImportTestModelA'));
13 $this->assertFalse(class_exists('ImportTestModelB'));
15 $this->assertEqual(Ak::import($models), array('ImportTestModelA','ImportTestModelB'));
17 $this->assertTrue(class_exists('ImportTestModelA'));
18 $this->assertTrue(class_exists('ImportTestModelB'));
20 $models = array('ImportTestModelB','Import Test Model C');
21 $this->assertEqual(Ak::import($models), array('ImportTestModelB','ImportTestModelC'));
23 $this->assertTrue(class_exists('ImportTestModelC'));
26 function Test_for_element_size()
28 $element = 'check_this_size';
29 $expected_value = 15;
30 $this->assertEqual(Ak::size($element), $expected_value);
32 $element = '123';
33 $expected_value = 3;
34 $this->assertEqual(Ak::size($element), $expected_value);
36 $element = 123;
37 $expected_value = 123;
38 $this->assertEqual(Ak::size($element), $expected_value);
40 $element = array(0=>'A', 1=>'B', 2=>'C', 3=>'D', 4=>array('E', 'F'));
41 $expected_value = 5;
42 $this->assertEqual(Ak::size($element), $expected_value);
45 function test_should_convert_between_timestamp_and_date()
47 $iso_date = '2007-10-15 16:30:00';
48 $this->assertEqual(Ak::getDate(Ak::getTimestamp($iso_date)), $iso_date);
49 $this->assertEqual(Ak::getDate(Ak::getTimestamp('2007-10-15 16:30')), $iso_date);
54 ak_test('test_Ak_support_functions');