From a825d17c0cb8dd63a9383f2e92bd048cf871146a Mon Sep 17 00:00:00 2001 From: Ewout Pieter den Ouden Date: Tue, 13 Nov 2018 19:58:06 +0100 Subject: [PATCH 1/2] Fix hidden dependency on related testCreateTwoMocksOfOneWsdlFile --- tests/unit/Framework/MockObject/MockObjectTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/Framework/MockObject/MockObjectTest.php b/tests/unit/Framework/MockObject/MockObjectTest.php index fe916f90332..cad33c56895 100644 --- a/tests/unit/Framework/MockObject/MockObjectTest.php +++ b/tests/unit/Framework/MockObject/MockObjectTest.php @@ -947,7 +947,7 @@ public function testCreateTwoMocksOfOneWsdlFile(): void */ public function testCreateMockOfWsdlFileWithSpecialChars(): void { - $mock = $this->getMockFromWsdl(__DIR__ . '/_fixture/Go ogle-Sea.rch.wsdl'); + $mock = $this->getMockFromWsdl(TEST_FILES_PATH . 'Go ogle-Sea.rch.wsdl'); $this->assertStringStartsWith('Mock_GoogleSearch_', \get_class($mock)); } From 3dbb52bcc90b92a58b34be6004ddfd74ebc9877e Mon Sep 17 00:00:00 2001 From: Ewout Pieter den Ouden Date: Tue, 13 Nov 2018 20:21:43 +0100 Subject: [PATCH 2/2] CLean up environment after test to prevent failures elsewhere. This test makes sure that the configuration file cannot override system environment settings by using putenv(). This is not restored by the backupGlobals system, causing another configuration test to fail. Obviously this could have been fixed by using a variable name other than 'foo', but I'll like having this here as a reminder of the dependency on putenv/getenv. --- tests/unit/Util/ConfigurationTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/unit/Util/ConfigurationTest.php b/tests/unit/Util/ConfigurationTest.php index 95d8652ebff..8e34e85ee55 100644 --- a/tests/unit/Util/ConfigurationTest.php +++ b/tests/unit/Util/ConfigurationTest.php @@ -428,11 +428,19 @@ public function testHandlePHPConfigurationDoesForceOverwrittenExistingEnvArrayVa */ public function testHandlePHPConfigurationDoesNotOverriteVariablesFromPutEnv(): void { + $backupFoo = \getenv('foo'); + \putenv('foo=putenv'); $this->configuration->handlePHPConfiguration(); $this->assertEquals('putenv', $_ENV['foo']); $this->assertEquals('putenv', \getenv('foo')); + + if ($backupFoo === false) { + \putenv('foo'); // delete variable from environment + } else { + \putenv("foo=$backupFoo"); + } } /**