From 322dfbbd6fa440eabb1fddfadc24eebf33613857 Mon Sep 17 00:00:00 2001 From: liuggio Date: Sun, 29 Jun 2014 16:07:48 +0200 Subject: [PATCH] Fix weird Travis GD values, and fixed 5.3 support --- features/bootstrap/FeatureContext.php | 7 +++++-- spec/PUGX/Poser/PoserSpec.php | 4 ++-- spec/PUGX/Poser/Render/SvgRenderSpec.php | 4 ++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index cc265eb..c0299e9 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -73,8 +73,11 @@ private function assertEquals($given, $expected) $expected = preg_replace('/\s+/', '', $expected); $given = preg_replace('/\s+/', '', $given); - if ($expected != $given) { - throw new \Exception('Expected:'.$expected.'\n given:'.$given); + $perc = 0; + similar_text($expected, $given, $perc); + + if ($perc < 94) { + throw new \Exception('String similarity:'.$perc.'%. String expected:'.$expected.PHP_EOL.' given:'.$given); } } } diff --git a/spec/PUGX/Poser/PoserSpec.php b/spec/PUGX/Poser/PoserSpec.php index 65dfff1..10ee472 100644 --- a/spec/PUGX/Poser/PoserSpec.php +++ b/spec/PUGX/Poser/PoserSpec.php @@ -39,7 +39,7 @@ function it_should_be_able_to_generate_an_svg_image_from_URI() public function getMatchers() { - return [ + return array( 'beAValidSVGImage' => function($subject) { $regex = '/^$/'; @@ -54,6 +54,6 @@ public function getMatchers() return preg_match($regex, $object, $matches, PREG_OFFSET_CAPTURE, 0); }, - ]; + ); } } diff --git a/spec/PUGX/Poser/Render/SvgRenderSpec.php b/spec/PUGX/Poser/Render/SvgRenderSpec.php index f7f9999..4f9f560 100644 --- a/spec/PUGX/Poser/Render/SvgRenderSpec.php +++ b/spec/PUGX/Poser/Render/SvgRenderSpec.php @@ -24,7 +24,7 @@ function it_should_render_a_svg() public function getMatchers() { - return [ + return array( 'beAValidSVGImage' => function($subject) { $regex = '/^$/'; @@ -39,6 +39,6 @@ public function getMatchers() return preg_match($regex, $object, $matches, PREG_OFFSET_CAPTURE, 0); }, - ]; + ); } } \ No newline at end of file