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
00038 $array = null;
00039
00040
00041 $fieldValue = CorujaArrayManipulation::getArrayField( $array );
00042
00043
00044 $this->assertNull( $fieldValue );
00045 }
00046
00050 public function testGetArrayFieldWithNoKey() {
00051
00052
00053 $array = array("one");
00054
00055
00056 $fieldValue = CorujaArrayManipulation::getArrayField( $array );
00057
00058
00059
00060
00061
00062 $this->markTestIncomplete(
00063 'Behavior not defined yet.'
00064 );
00065 }
00066
00070 public function testGetArrayFieldWithNoneArray() {
00071
00072
00073 $integer = 2;
00074
00075
00076 $fieldValue = CorujaArrayManipulation::getArrayField( $integer, 0 );
00077
00078
00079
00080
00081
00082 $this->markTestIncomplete(
00083 'Behavior not defined yet.'
00084 );
00085 }
00086
00090 public function testGetArrayFieldWithExistingKey() {
00091
00092
00093 $array = array("one");
00094
00095
00096 $fieldValue = CorujaArrayManipulation::getArrayField( $array, 0 );
00097
00098
00099 $this->assertEquals( "one", $fieldValue );
00100 }
00101
00105 public function testGetArrayFieldWithNoneExistingKey() {
00106
00107
00108 $array = array("one");
00109
00110
00111 $fieldValue = CorujaArrayManipulation::getArrayField( $array, 2 );
00112
00113
00114 $this->assertNull( $fieldValue );
00115 }
00116
00120 public function testGetArrayFieldWithNoneExistingKeyAndThirdParameter() {
00121
00122
00123 $array = array("one");
00124
00125
00126 $fieldValue = CorujaArrayManipulation::getArrayField( $array, 2, "anything" );
00127
00128
00129 $this->assertEquals( "anything", $fieldValue );
00130 }
00131
00135 public function testGetArrayFieldWithNullKey() {
00136
00137
00138 $array = array("one");
00139
00140
00141 $fieldValue = CorujaArrayManipulation::getArrayField( $array, null, "anything" );
00142
00143
00144 $this->assertEquals( "anything", $fieldValue );
00145 }
00146
00147
00148 }
00149 ?>