CorujaArrayManipulationTest.php

Go to the documentation of this file.
00001 <?php
00002 require_once 'PHPUnit/Framework.php';
00003 
00004 require_once dirname( __FILE__ ).'/../../../_start.php';
00005 
00010 class CorujaArrayManipulationTest extends PHPUnit_Framework_TestCase
00011 {
00018     protected function setUp()
00019     {
00020     }
00021 
00028     protected function tearDown()
00029     {
00030     }
00031 
00035     public function testGetArrayFieldWithNullArray() {
00036 
00037         // set up
00038         $array = null;
00039 
00040         // exercise
00041         $fieldValue = CorujaArrayManipulation::getArrayField( $array );
00042 
00043         // assert
00044         $this->assertNull( $fieldValue );
00045     }
00046 
00050     public function testGetArrayFieldWithNoKey() {
00051 
00052         // set up
00053         $array = array("one");
00054 
00055         // exercise
00056         $fieldValue = CorujaArrayManipulation::getArrayField( $array );
00057 
00058         // assert
00059 
00060 
00061         // Remove the following lines when you implement this test.
00062         $this->markTestIncomplete(
00063           'Behavior not defined yet.'
00064         );
00065     }
00066 
00070     public function testGetArrayFieldWithNoneArray() {
00071 
00072         // set up
00073         $integer = 2;
00074 
00075         // exercise
00076         $fieldValue = CorujaArrayManipulation::getArrayField( $integer, 0 );
00077 
00078         // assert
00079 
00080 
00081         // Remove the following lines when you implement this test.
00082         $this->markTestIncomplete(
00083           'Behavior not defined yet.'
00084         );
00085     }
00086 
00090     public function testGetArrayFieldWithExistingKey() {
00091 
00092         // set up
00093         $array = array("one");
00094 
00095         // exercise
00096         $fieldValue = CorujaArrayManipulation::getArrayField( $array, 0 );
00097 
00098         // assert
00099         $this->assertEquals( "one", $fieldValue );
00100     }
00101 
00105     public function testGetArrayFieldWithNoneExistingKey() {
00106 
00107         // set up
00108         $array = array("one");
00109 
00110         // exercise
00111         $fieldValue = CorujaArrayManipulation::getArrayField( $array, 2 );
00112 
00113         // assert
00114         $this->assertNull( $fieldValue );
00115     }
00116 
00120     public function testGetArrayFieldWithNoneExistingKeyAndThirdParameter() {
00121 
00122         // set up
00123         $array = array("one");
00124 
00125         // exercise
00126         $fieldValue = CorujaArrayManipulation::getArrayField( $array, 2, "anything" );
00127 
00128         // assert
00129         $this->assertEquals( "anything", $fieldValue );
00130     }
00131 
00135     public function testGetArrayFieldWithNullKey() {
00136 
00137         // set up
00138         $array = array("one");
00139 
00140         // exercise
00141         $fieldValue = CorujaArrayManipulation::getArrayField( $array, null, "anything" );
00142 
00143         // assert
00144         $this->assertEquals( "anything", $fieldValue );
00145     }
00146 
00147 
00148 }
00149 ?>

Generated on Sat Apr 7 14:19:09 2012 for CodeToDiagram by  doxygen 1.5.9