utArray Class Reference
[Unit Tests - Unit tests for all classes/functions in fareofficelib.]

Unit test for all functions in Array.php. More...

List of all members.

Public Member Functions

 doTest ()

Private Member Functions

 _testArray ()


Detailed Description

Unit test for all functions in Array.php.

Author:
Daniel Lindh <[email protected]>

Definition at line 8 of file utArray.php.


Member Function Documentation

utArray::_testArray (  )  [private]

Definition at line 15 of file utArray.php.

Referenced by doTest().

00016   {
00017     $this->setSectionLabel('getHtmlArray');
00018 
00019     $arr = array();
00020     $arr['contact']['first_name'] = 'Daniel';
00021     $arr['contact']['last_name'] = 'Lindh';
00022     $arr['contact']['address'] = '';
00023     $arr['contact']['age'] = 32;
00024     $arr['contact']['parent_contact'] = NULL;
00025     $arr['contact']['has_icq'] = false;
00026     $arr['contact']['phone_numbers'] = array();
00027     $arr['orders'][0]['id'] = 32;
00028     $arr['orders'][0]['description'] = 'Honda Fireblade 929 - 99';
00029     $arr['orders'][0]['price'] = '45000';
00030     $arr['orders'][0]['currency'] = 'SEK';
00031     $arr['orders'][1]['id'] = 33;
00032     $arr['orders'][1]['description'] = 'Computer';
00033     $arr['orders'][1]['price'] = '2000';
00034     $arr['orders'][1]['currency'] = 'SEK';
00035 
00036     eval($this->needEqual('getHtmlArray($arr)', '"<table border=\"1\" cellspacing=\"0\" cellpadding=\"3\"><tr><td colspan=\"4\">Count:0</td></tr><tr><td>key</td><td>value</td><td>type</td><td>size</td></tr><tr><td>contact</td><td colspan=\"3\"><table border=\"1\" cellspacing=\"0\" cellpadding=\"3\"><tr><td colspan=\"4\">Count:0</td></tr><tr><td>key</td><td>value</td><td>type</td><td>size</td></tr><tr><td>first_name</td><td>Daniel</td><td>string</td><td>6</td></tr><tr><td>last_name</td><td>Lindh</td><td>string</td><td>5</td></tr><tr><td>address</td><td>EMPTY</td><td>string</td><td>0</td></tr><tr><td>age</td><td>32</td><td>integer</td><td>1</td></tr><tr><td>parent_contact</td><td>NULL</td><td>NULL</td><td>0</td></tr><tr><td>has_icq</td><td>FALSE</td><td>boolean</td><td>1</td></tr><tr><td>phone_numbers</td><td colspan=\"3\"><table border=\"1\" cellspacing=\"0\" cellpadding=\"3\"><tr><td colspan=\"4\">Count:0</td></tr><tr><td>key</td><td>value</td><td>type</td><td>size</td></tr></table></td></tr></table></td></tr><tr><td>orders</td><td colspan=\"3\"><table border=\"1\" cellspacing=\"0\" cellpadding=\"3\"><tr><td colspan=\"4\">Count:0</td></tr><tr><td>key</td><td>value</td><td>type</td><td>size</td></tr><tr><td>0</td><td colspan=\"3\"><table border=\"1\" cellspacing=\"0\" cellpadding=\"3\"><tr><td colspan=\"4\">Count:0</td></tr><tr><td>key</td><td>value</td><td>type</td><td>size</td></tr><tr><td>id</td><td>32</td><td>integer</td><td>1</td></tr><tr><td>description</td><td>Honda Fireblade 929 - 99</td><td>string</td><td>24</td></tr><tr><td>price</td><td>45000</td><td>string</td><td>5</td></tr><tr><td>currency</td><td>SEK</td><td>string</td><td>3</td></tr></table></td></tr><tr><td>1</td><td colspan=\"3\"><table border=\"1\" cellspacing=\"0\" cellpadding=\"3\"><tr><td colspan=\"4\">Count:0</td></tr><tr><td>key</td><td>value</td><td>type</td><td>size</td></tr><tr><td>id</td><td>33</td><td>integer</td><td>1</td></tr><tr><td>description</td><td>Computer</td><td>string</td><td>8</td></tr><tr><td>price</td><td>2000</td><td>string</td><td>4</td></tr><tr><td>currency</td><td>SEK</td><td>string</td><td>3</td></tr></table></td></tr></table></td></tr></table>"'));
00037     eval($this->needEqual('getHtmlArrayPhp($arr)', '"array<br/>(<br/>&nbsp;&nbsp;\'contact\' => array<br/>&nbsp;&nbsp;(<br/>&nbsp;&nbsp;&nbsp;&nbsp;\'first_name\' => \'Daniel\',<br/>&nbsp;&nbsp;&nbsp;&nbsp;\'last_name\' => \'Lindh\',<br/>&nbsp;&nbsp;&nbsp;&nbsp;\'address\' => \'\',<br/>&nbsp;&nbsp;&nbsp;&nbsp;\'age\' => 32,<br/>&nbsp;&nbsp;&nbsp;&nbsp;\'parent_contact\' => NULL,<br/>&nbsp;&nbsp;&nbsp;&nbsp;\'has_icq\' => FALSE,<br/>&nbsp;&nbsp;&nbsp;&nbsp;\'phone_numbers\' => array<br/>&nbsp;&nbsp;&nbsp;&nbsp;(<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;)<br/>&nbsp;&nbsp;),<br/>&nbsp;&nbsp;\'orders\' => array<br/>&nbsp;&nbsp;(<br/>&nbsp;&nbsp;&nbsp;&nbsp;\'0\' => array<br/>&nbsp;&nbsp;&nbsp;&nbsp;(<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'id\' => 32,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'description\' => \'Honda Fireblade 929 - 99\',<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'price\' => \'45000\',<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'currency\' => \'SEK\'<br/>&nbsp;&nbsp;&nbsp;&nbsp;),<br/>&nbsp;&nbsp;&nbsp;&nbsp;\'1\' => array<br/>&nbsp;&nbsp;&nbsp;&nbsp;(<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'id\' => 33,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'description\' => \'Computer\',<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'price\' => \'2000\',<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\'currency\' => \'SEK\'<br/>&nbsp;&nbsp;&nbsp;&nbsp;)<br/>&nbsp;&nbsp;)<br/>)"'));
00038 
00039     $arr2 = $arr;
00040     $arr2['diff_key']['key_diff'] = 'value';
00041     $arr['orders'][1]['description'] = 'Compute';
00042     eval($this->needEqual('array_diff_assoc_recursive($arr, $arr2)', 'array(\'orders\'=>array(\'1\'=>array(\'description\'=>\'Compute\')))'));
00043     eval($this->needEqual('array_diff_assoc_recursive($arr2, $arr)', 'array(\'orders\'=>array(\'1\'=>array(\'description\'=>\'Computer\')),\'diff_key\'=>array(\'key_diff\'=>\'value\'))'));
00044   }

utArray::doTest (  ) 

Definition at line 10 of file utArray.php.

References _testArray().

00011   {
00012     $this->_testArray();
00013   }


The documentation for this class was generated from the following file:

Generated on Thu Apr 30 17:52:30 2009 for fareofficelib by  doxygen 1.5.8