From 93d16b886fc5ea3ec5115bfac6cf571e5c91ee72 Mon Sep 17 00:00:00 2001 From: MarkBaker Date: Thu, 28 May 2015 23:15:46 +0100 Subject: [PATCH] Start changing some unit tests to use a json provider rather than the current excessively complex csv provider --- .../src/Cell/DefaultValueBinderTest.php | 4 +- unitTests/Classes/src/Style/ColorTest.php | 17 ++++----- .../rawTestData/Cell/DefaultValueBinder.data | 19 ---------- .../rawTestData/Cell/DefaultValueBinder.json | 37 +++++++++---------- .../Style/ColorChangeBrightness.data | 14 ------- .../Style/ColorChangeBrightness.json | 14 +++++++ 6 files changed, 41 insertions(+), 64 deletions(-) delete mode 100644 unitTests/rawTestData/Cell/DefaultValueBinder.data delete mode 100644 unitTests/rawTestData/Style/ColorChangeBrightness.data create mode 100644 unitTests/rawTestData/Style/ColorChangeBrightness.json diff --git a/unitTests/Classes/src/Cell/DefaultValueBinderTest.php b/unitTests/Classes/src/Cell/DefaultValueBinderTest.php index 4405f335..aebee164 100644 --- a/unitTests/Classes/src/Cell/DefaultValueBinderTest.php +++ b/unitTests/Classes/src/Cell/DefaultValueBinderTest.php @@ -1,6 +1,5 @@ assertEquals($expectedResult, $result); } diff --git a/unitTests/Classes/src/Style/ColorTest.php b/unitTests/Classes/src/Style/ColorTest.php index 2d9188ef..83427b10 100644 --- a/unitTests/Classes/src/Style/ColorTest.php +++ b/unitTests/Classes/src/Style/ColorTest.php @@ -1,7 +1,7 @@ assertEquals($expectedResult, $result); } @@ -37,7 +37,7 @@ class ColorTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Style_Color','getGreen'), $args); + $result = call_user_func_array(array('\\PHPExcel\\Style\\Color','getGreen'), $args); $this->assertEquals($expectedResult, $result); } @@ -53,7 +53,7 @@ class ColorTest extends PHPUnit_Framework_TestCase { $args = func_get_args(); $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Style_Color','getBlue'), $args); + $result = call_user_func_array(array('\\PHPExcel\\Style\\Color','getBlue'), $args); $this->assertEquals($expectedResult, $result); } @@ -67,14 +67,13 @@ class ColorTest extends PHPUnit_Framework_TestCase */ public function testChangeBrightness() { - $args = func_get_args(); - $expectedResult = array_pop($args); - $result = call_user_func_array(array('PHPExcel_Style_Color','changeBrightness'), $args); + list($args, $expectedResult) = func_get_args(); + $result = call_user_func_array(array('\\PHPExcel\\Style\\Color','changeBrightness'), $args); $this->assertEquals($expectedResult, $result); } public function providerColorChangeBrightness() { - return new testDataFileIterator('rawTestData/Style/ColorChangeBrightness.data'); + return new testDataFileIteratorJson('rawTestData/Style/ColorChangeBrightness.json'); } } diff --git a/unitTests/rawTestData/Cell/DefaultValueBinder.data b/unitTests/rawTestData/Cell/DefaultValueBinder.data deleted file mode 100644 index 446ded6c..00000000 --- a/unitTests/rawTestData/Cell/DefaultValueBinder.data +++ /dev/null @@ -1,19 +0,0 @@ -NULL, "null" -, "null" -"#NULL!", "e" -FALSE, "b" -TRUE, "b" -"FALSE", "s" -"TRUE", "s" -"", "s" -"ABC", "s" -"123", "n" -123, "n" -0.123, "n" -"-123", "n" -"1.23E4", "n" -"-1.23E4", "n" -"1.23E-4", "n" -"000123", "s" -"=123", "f" -"#DIV/0!", "e" diff --git a/unitTests/rawTestData/Cell/DefaultValueBinder.json b/unitTests/rawTestData/Cell/DefaultValueBinder.json index 9bb33a7f..cda669a6 100644 --- a/unitTests/rawTestData/Cell/DefaultValueBinder.json +++ b/unitTests/rawTestData/Cell/DefaultValueBinder.json @@ -1,19 +1,18 @@ -[null,"null"] -[null,"null"] -["#NULL!","e"] -[false,"b"] -[true,"b"] -["FALSE","s"] -["TRUE","s"] -["","s"] -["ABC","s"] -["123","n"] -[123,"n"] -[0.123,"n"] -["-123","n"] -["1.23E4","n"] -["-1.23E4","n"] -["1.23E-4","n"] -["000123","s"] -["=123","f"] -["#DIV\/0!","e"] +[[null],"null"] +[["#NULL!"],"e"] +[[false],"b"] +[[true],"b"] +[["FALSE"],"s"] +[["TRUE"],"s"] +[[""],"s"] +[["ABC"],"s"] +[["123"],"n"] +[[123],"n"] +[[0.123],"n"] +[["-123"],"n"] +[["1.23E4"],"n"] +[["-1.23E4"],"n"] +[["1.23E-4"],"n"] +[["000123"],"s"] +[["=123"],"f"] +[["#DIV\/0!"],"e"] diff --git a/unitTests/rawTestData/Style/ColorChangeBrightness.data b/unitTests/rawTestData/Style/ColorChangeBrightness.data deleted file mode 100644 index de5eeaf5..00000000 --- a/unitTests/rawTestData/Style/ColorChangeBrightness.data +++ /dev/null @@ -1,14 +0,0 @@ -"FFAABBCC", 0.1, "FFB2C1D1" // RGBA -"FFAABBCC", -0.1, "FF99A8B7" // RGBA -"AABBCC", 0.1, "B2C1D1" // RGB -"AABBCC", -0.1, "99A8B7" // RGB -"FF0000", 0.1, "FF1919" -"FF0000", -0.1, "E50000" -"FF8080", 0.1, "FF8C8C" -"FF8080", -0.1, "E57373" -"FF0000", 0.15, "FF2626" -"FF0000", -0.15, "D80000" -"FF8080", 0.15, "FF9393" -"FF8080", -0.15, "D86C6C" -"FFF008", 0.5, "FFF783" -"FFF008", -0.5, "7F7804" diff --git a/unitTests/rawTestData/Style/ColorChangeBrightness.json b/unitTests/rawTestData/Style/ColorChangeBrightness.json new file mode 100644 index 00000000..d61d9b5a --- /dev/null +++ b/unitTests/rawTestData/Style/ColorChangeBrightness.json @@ -0,0 +1,14 @@ +[["FFAABBCC",0.1],"FFB2C1D1"] // RGBA +[["FFAABBCC",-0.1],"FF99A8B7"] // RGBA +[["AABBCC",0.1],"B2C1D1"] // RGB +[["AABBCC",-0.1],"99A8B7"] +[["FF0000",0.1],"FF1919"] +[["FF0000",-0.1],"E50000"] +[["FF8080",0.1],"FF8C8C"] +[["FF8080",-0.1],"E57373"] +[["FF0000",0.15],"FF2626"] +[["FF0000",-0.15],"D80000"] +[["FF8080",0.15],"FF9393"] +[["FF8080",-0.15],"D86C6C"] +[["FFF008",0.5],"FFF783"] +[["FFF008",-0.5],"7F7804"]