Changeset 3131 for trunk/modules
- Timestamp:
- 07/16/2008 08:39:52 PM (5 months ago)
- Location:
- trunk/modules/unit_test
- Files:
-
- 3 modified
-
i18n/en_US/unit_test.php (modified) (1 diff)
-
libraries/Unit_Test.php (modified) (4 diffs)
-
tests/Example_Test.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/modules/unit_test/i18n/en_US/unit_test.php
r3130 r3131 30 30 'assert_not_float' => 'assert_not_float: Expected not a float, but was given (%s) %s.', 31 31 'assert_array' => 'assert_array: Expected an array, but was given (%s) %s.', 32 'assert_array_key' => 'assert_array_key: Expected a valid key, but was given (%s) %s.', 32 'assert_array_key' => 'assert_array_key: Expected a valid key, but was given (%s) %s.', 33 'assert_in_array' => 'assert_in_array: Expected a valid value, but was given (%s) %s.', 33 34 'assert_not_array' => 'assert_not_array: Expected not an array, but was given (%s) %s.', 34 35 'assert_object' => 'assert_object: Expected an object, but was given (%s) %s.', -
trunk/modules/unit_test/libraries/Unit_Test.php
r3130 r3131 364 364 } 365 365 366 public function assert_array_key($key, $array )366 public function assert_array_key($key, $array, $debug = NULL) 367 367 { 368 368 if ( ! array_key_exists($key, $array)) { 369 throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_array_key', gettype($ value), var_export($value, TRUE)), $debug);369 throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_array_key', gettype($key), var_export($key, TRUE)), $debug); 370 370 } 371 371 372 return $this; 373 } 374 375 public function assert_in_array($value, $array, $debug = NULL) 376 { 377 if ( ! in_array($value, $array)) { 378 throw new Kohana_Unit_Test_Exception(Kohana::lang('unit_test.assert_in_array', gettype($value), var_export($value, TRUE)), $debug); 379 } 380 372 381 return $this; 373 382 } … … 445 454 } 446 455 447 public function assert_class_attribute( )456 public function assert_class_attribute($attribute, $class) 448 457 { 449 458 … … 452 461 } 453 462 454 public function assert_class_static_attribute( )463 public function assert_class_static_attribute($attribute, $class) 455 464 { 456 465 … … 459 468 } 460 469 470 public function assert_file_exists($file) 471 { 472 473 474 475 } 476 461 477 } // End Unit_Test_Case 462 478 -
trunk/modules/unit_test/tests/Example_Test.php
r3130 r3131 78 78 $this->assert_array_key("a", $array); 79 79 } 80 80 81 public function in_array_test() 82 { 83 $array = array("X", "Y", "Z"); 84 $this->assert_in_array("X", $array); 85 } 81 86 82 87 public function debug_example_test()
