From 8763e475adc7bb26ed9705c9d61a1db2b20e60c4 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 9 Feb 2010 15:52:38 -0800 Subject: Move diff::compare to be test::diff --- modules/gallery_unit_test/helpers/diff.php | 26 ---------------------- modules/gallery_unit_test/helpers/test.php | 6 +++++ .../libraries/Gallery_Unit_Test_Case.php | 2 +- 3 files changed, 7 insertions(+), 27 deletions(-) delete mode 100644 modules/gallery_unit_test/helpers/diff.php (limited to 'modules/gallery_unit_test') diff --git a/modules/gallery_unit_test/helpers/diff.php b/modules/gallery_unit_test/helpers/diff.php deleted file mode 100644 index 7b573732..00000000 --- a/modules/gallery_unit_test/helpers/diff.php +++ /dev/null @@ -1,26 +0,0 @@ -save()->reload(); } + + static function diff($a, $b) { + fwrite(fopen($a_name = tempnam("/tmp", "test"), "w"), $a); + fwrite(fopen($b_name = tempnam("/tmp", "test"), "w"), $b); + return `diff $a_name $b_name`; + } } diff --git a/modules/gallery_unit_test/libraries/Gallery_Unit_Test_Case.php b/modules/gallery_unit_test/libraries/Gallery_Unit_Test_Case.php index 509b4125..545af0fe 100644 --- a/modules/gallery_unit_test/libraries/Gallery_Unit_Test_Case.php +++ b/modules/gallery_unit_test/libraries/Gallery_Unit_Test_Case.php @@ -24,7 +24,7 @@ class Gallery_Unit_Test_Case extends Unit_Test_Case { sprintf("Expected (%s) %s but received (%s) %s\n Diff: %s", gettype($expected), var_export($expected, true), gettype($actual), var_export($actual, true), - diff::compare(var_export($expected, true), var_export($actual, true))), + test::diff(var_export($expected, true), var_export($actual, true))), $debug); } return $this; -- cgit v1.2.3