Skip to content

Commit 04f9d83

Browse files
committed
Make components' tests run on their own and from main repo.
Each component has dedicated test config and bootstrap. Duplication of parts of the skeleton is not ideal, but helps to reduce dependencies between each test suite. Also, this eases the future subtree split.
1 parent a49c733 commit 04f9d83

6 files changed

Lines changed: 45 additions & 3 deletions

File tree

phpunit.xml.dist

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<phpunit backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
bootstrap="tests/bootstrap.php"
13+
>
14+
<testsuites>
15+
<testsuite name="React Test Suite">
16+
<directory>./tests/</directory>
17+
</testsuite>
18+
</testsuites>
19+
20+
<filter>
21+
<whitelist>
22+
<directory>./src/</directory>
23+
</whitelist>
24+
</filter>
25+
</phpunit>

tests/CallableStub.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace React\Tests\Dns;
4+
5+
class CallableStub
6+
{
7+
public function __invoke()
8+
{
9+
}
10+
}

tests/Query/ExecutorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,6 @@ protected function expectCallableNever()
295295

296296
protected function createCallableMock()
297297
{
298-
return $this->getMock('React\Tests\Socket\Stub\CallableStub');
298+
return $this->getMock('React\Tests\Dns\CallableStub');
299299
}
300300
}

tests/Query/RetryExecutorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ protected function expectPromiseOnce($return = null)
157157

158158
protected function createCallableMock()
159159
{
160-
return $this->getMock('React\Tests\Socket\Stub\CallableStub');
160+
return $this->getMock('React\Tests\Dns\CallableStub');
161161
}
162162

163163
protected function createExecutorMock()

tests/Resolver/ResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ protected function expectCallableNever()
149149

150150
protected function createCallableMock()
151151
{
152-
return $this->getMock('React\Tests\Socket\Stub\CallableStub');
152+
return $this->getMock('React\Tests\Dns\CallableStub');
153153
}
154154

155155
private function createExecutorMock()

tests/bootstrap.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$loader = @include __DIR__ . '/../vendor/autoload.php';
4+
if (!$loader) {
5+
$loader = require __DIR__ . '/../../../vendor/autoload.php';
6+
}
7+
$loader->addPsr4('React\\Tests\\Dns\\', __DIR__);

0 commit comments

Comments
 (0)