diff --git a/src/Framework/TestCase.php b/src/Framework/TestCase.php index ac6f087e9cf..6751c8472c6 100755 --- a/src/Framework/TestCase.php +++ b/src/Framework/TestCase.php @@ -1050,6 +1050,14 @@ public function setInIsolation($inIsolation) } } + /** + * @return boolean + */ + public function isInIsolation() + { + return $this->inIsolation; + } + /** * @return mixed * @since Method available since Release 3.4.0 diff --git a/tests/Framework/TestCaseTest.php b/tests/Framework/TestCaseTest.php index 337b00a7889..1a0f14bc13b 100644 --- a/tests/Framework/TestCaseTest.php +++ b/tests/Framework/TestCaseTest.php @@ -362,6 +362,25 @@ public function testStaticAttributesBackupPost() $this->assertSame(123, self::$_testStatic); } + public function testIsInIsolationReturnsFalse() + { + $test = new IsolationTest('testIsInIsolationReturnsFalse'); + $result = $test->run(); + + $this->assertEquals(1, count($result)); + $this->assertTrue($result->wasSuccessful()); + } + + public function testIsInIsolationReturnsTrue() + { + $test = new IsolationTest('testIsInIsolationReturnsTrue'); + $test->setRunTestInSeparateProcess(true); + $result = $test->run(); + + $this->assertEquals(1, count($result)); + $this->assertTrue($result->wasSuccessful()); + } + public function testExpectOutputStringFooActualFoo() { $test = new OutputTestCase('testExpectOutputStringFooActualFoo'); diff --git a/tests/_files/IsolationTest.php b/tests/_files/IsolationTest.php new file mode 100644 index 00000000000..df95c916826 --- /dev/null +++ b/tests/_files/IsolationTest.php @@ -0,0 +1,13 @@ +assertFalse($this->isInIsolation()); + } + + public function testIsInIsolationReturnsTrue() + { + $this->assertTrue($this->isInIsolation()); + } +}