From 3cc6056a7d20fc550b2b21d5f36d05191afcb60e Mon Sep 17 00:00:00 2001 From: Timo Ebel Date: Wed, 19 Apr 2023 12:10:29 +0200 Subject: [PATCH] CURB-3054 Fix for data providers apparently run before set_up() in newer PHPUnit versions. --- tests/integration/ShopgatePluginApiTest.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/integration/ShopgatePluginApiTest.php b/tests/integration/ShopgatePluginApiTest.php index 5757ced..890f88d 100644 --- a/tests/integration/ShopgatePluginApiTest.php +++ b/tests/integration/ShopgatePluginApiTest.php @@ -49,7 +49,7 @@ class ShopgatePluginApiTest extends ShopgateTestCase ); /** @var string */ - private $tmpCategoriesXmlFilePath; + private static $tmpCategoriesXmlFilePath = '/tmp/shopgate_categories.xml'; /** @var ShopgatePluginApi $subjectUnderTest */ private $subjectUnderTest; @@ -65,8 +65,6 @@ class ShopgatePluginApiTest extends ShopgateTestCase public function set_up() { - $this->tmpCategoriesXmlFilePath = '/tmp/shopgate_categories.xml'; - $this->shopgateConfigMock = $this->getMockBuilder('\ShopgateConfigInterface')->getMockForAbstractClass(); $this->shopgateConfigMock->method('getCronJobWhiteList')->willReturn(self::$cronJobWhiteList); @@ -100,8 +98,8 @@ public function set_up() public function tear_down() { - if (file_exists($this->tmpCategoriesXmlFilePath)) { - unlink($this->tmpCategoriesXmlFilePath); + if (file_exists(self::$tmpCategoriesXmlFilePath)) { + unlink(self::$tmpCategoriesXmlFilePath); } } @@ -172,15 +170,15 @@ public function provideExternalResponseHandlingSetups() 'customer_language' => 'en_US' ), ), - "get_categories to file {$this->tmpCategoriesXmlFilePath}" => array( + 'get_categories to file ' . self::$tmpCategoriesXmlFilePath => array( 'expectedOutputBuffer' => '', - 'expectedResponse' => new ShopgatePluginApiResponseAppXmlExport($traceId, $this->tmpCategoriesXmlFilePath), + 'expectedResponse' => new ShopgatePluginApiResponseAppXmlExport($traceId, self::$tmpCategoriesXmlFilePath), 'action' => 'get_categories', 'parameters' => array( 'limit' => 100, 'offset' => 5, ), - 'filePath' => $this->tmpCategoriesXmlFilePath + 'filePath' => self::$tmpCategoriesXmlFilePath ), 'get_categories to file php://output' => array( 'expectedOutputBuffer' => '',