From 1e69dbadf7e582fb0b6ad422dfff2f7ff154df8d Mon Sep 17 00:00:00 2001 From: Ivan Chepurnyi Date: Fri, 31 Oct 2014 10:23:50 +0100 Subject: [PATCH 1/2] Fix issue with current store code --- app/code/community/EcomDev/PHPUnit/Test/Case/Util.php | 1 + app/code/community/EcomDev/PHPUnit/Test/Listener.php | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/code/community/EcomDev/PHPUnit/Test/Case/Util.php b/app/code/community/EcomDev/PHPUnit/Test/Case/Util.php index d8388851..72fd9f54 100644 --- a/app/code/community/EcomDev/PHPUnit/Test/Case/Util.php +++ b/app/code/community/EcomDev/PHPUnit/Test/Case/Util.php @@ -511,6 +511,7 @@ public static function getGroupedClassMockBuilder(PHPUnit_Framework_TestCase $te public static function setUp() { self::app()->resetDispatchedEvents(); + self::$originalStore = Mage::app()->getStore()->getCode(); } /** diff --git a/app/code/community/EcomDev/PHPUnit/Test/Listener.php b/app/code/community/EcomDev/PHPUnit/Test/Listener.php index aa8ee806..f9d043f8 100644 --- a/app/code/community/EcomDev/PHPUnit/Test/Listener.php +++ b/app/code/community/EcomDev/PHPUnit/Test/Listener.php @@ -173,6 +173,9 @@ public function endTest(PHPUnit_Framework_Test $test, $time) )); if ($test instanceof PHPUnit_Framework_TestCase) { + EcomDev_PHPUnit_Helper::tearDown(); + EcomDev_PHPUnit_Test_Case_Util::tearDown(); + EcomDev_PHPUnit_Test_Case_Util::getFixture(get_class($test)) ->setScope(EcomDev_PHPUnit_Model_FixtureInterface::SCOPE_LOCAL) ->discard(); // Clear applied fixture @@ -180,9 +183,6 @@ public function endTest(PHPUnit_Framework_Test $test, $time) if (EcomDev_PHPUnit_Test_Case_Util::getExpectation(get_class($test))->isLoaded()) { EcomDev_PHPUnit_Test_Case_Util::getExpectation(get_class($test))->discard(); } - - EcomDev_PHPUnit_Test_Case_Util::tearDown(); - EcomDev_PHPUnit_Helper::tearDown(); } Mage::dispatchEvent('phpunit_test_end_after', array( From 085ebab29676de752bc92959ad373b89e0dadc85 Mon Sep 17 00:00:00 2001 From: p-makowski Date: Mon, 26 Jan 2015 09:21:09 +0100 Subject: [PATCH 2/2] [BUGFIX] Update bootstrap.php Autoloader implementations MUST NOT throw exceptions, MUST NOT raise errors of any level. Fixes errors like this: PHP Fatal error: Uncaught exception 'Exception' with message 'Warning: include(PHPUnit/Extensions/Story/TestCase.php): failed to open stream: No such file or directory in [..]/vendor/ecomdev/phpunit/app/code/community/EcomDev/PHPUnit/bootstrap.php on line 54' in [...]/htdocs/app/code/core/Mage/Core/functions.php:245 --- app/code/community/EcomDev/PHPUnit/bootstrap.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/code/community/EcomDev/PHPUnit/bootstrap.php b/app/code/community/EcomDev/PHPUnit/bootstrap.php index 772b395e..8a3154c9 100644 --- a/app/code/community/EcomDev/PHPUnit/bootstrap.php +++ b/app/code/community/EcomDev/PHPUnit/bootstrap.php @@ -51,6 +51,11 @@ ) ); - @include $filePath . '.php'; + $classFile = $filePath . '.php'; + if (stream_resolve_include_path($classFile)) { + return include $classFile; + } else { + return false; + } }); }