Skip to content

Commit b46a1e1

Browse files
committed
Issue #2981870 by Lendude, alexpott: Duplicate BrokenSetUpTest for BrowserTestBase
(cherry picked from commit 4da678e)
1 parent 4eb2721 commit b46a1e1

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

modules/simpletest/src/Tests/BrokenSetUpTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* database tables. Therefore, we ensure that tests which are not set up
1313
* properly are skipped.
1414
*
15-
* @group simpletest
15+
* @group WebTestBase
1616
* @see \Drupal\simpletest\WebTestBase
1717
*/
1818
class BrokenSetUpTest extends WebTestBase {

tests/Drupal/Tests/Core/Test/BrowserTestBaseTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,22 @@ public function testGetHttpClientException() {
7979
$ref_gethttpclient->invoke($btb);
8080
}
8181

82+
/**
83+
* Test that tearDown doesn't call cleanupEnvironment if setUp is not called.
84+
*
85+
* @covers ::tearDown
86+
*/
87+
public function testTearDownWithoutSetUp() {
88+
$method = 'cleanupEnvironment';
89+
$this->assertTrue(method_exists(BrowserTestBase::class, $method));
90+
$btb = $this->getMockBuilder(BrowserTestBase::class)
91+
->disableOriginalConstructor()
92+
->setMethods([$method])
93+
->getMockForAbstractClass();
94+
$btb->expects($this->never())->method($method);
95+
$ref_tearDown = new \ReflectionMethod($btb, 'tearDown');
96+
$ref_tearDown->setAccessible(TRUE);
97+
$ref_tearDown->invoke($btb);
98+
}
99+
82100
}

0 commit comments

Comments
 (0)