Skip to content

Commit faa8307

Browse files
committed
Properly handle skipped tests
1 parent f39fb00 commit faa8307

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
composer.lock
55
.phpstorm.meta.php
66
phpunit.xml
7-
.phpunit.result.cache
7+
.phpunit.*
88
.php_cs.cache

tests/Feature/SslQueueTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66

77
class SslQueueTest extends TestCase
88
{
9+
protected bool $interactsWithConnection = false;
10+
911
protected function setUp(): void
1012
{
13+
parent::setUp();
14+
1115
$this->markTestSkipped();
1216
}
1317

tests/Feature/TestCase.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,22 @@
1414

1515
abstract class TestCase extends BaseTestCase
1616
{
17+
/**
18+
* Set to false for skipped tests.
19+
*/
20+
protected bool $interactsWithConnection = true;
21+
1722
/**
1823
* @throws AMQPProtocolChannelException
1924
*/
2025
protected function setUp(): void
2126
{
2227
parent::setUp();
2328

24-
if ($this->connection()->isQueueExists()) {
25-
$this->connection()->purge();
29+
if ($this->interactsWithConnection) {
30+
if ($this->connection()->isQueueExists()) {
31+
$this->connection()->purge();
32+
}
2633
}
2734
}
2835

@@ -31,11 +38,13 @@ protected function setUp(): void
3138
*/
3239
protected function tearDown(): void
3340
{
34-
if ($this->connection()->isQueueExists()) {
35-
$this->connection()->purge();
36-
}
41+
if ($this->interactsWithConnection) {
42+
if ($this->connection()->isQueueExists()) {
43+
$this->connection()->purge();
44+
}
3745

38-
self::assertSame(0, Queue::size());
46+
self::assertSame(0, Queue::size());
47+
}
3948

4049
parent::tearDown();
4150
}

0 commit comments

Comments
 (0)