Skip to content

Commit def1876

Browse files
committed
Merge branch 'refs/heads/clue-tests'
2 parents 8335f30 + 782c2eb commit def1876

File tree

84 files changed

+697
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+697
-28
lines changed

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
>
1414
<testsuites>
1515
<testsuite name="React Test Suite">
16-
<directory>./tests/</directory>
16+
<directory>./src/*/tests/</directory>
1717
</testsuite>
1818
</testsuites>
1919

src/Cache/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/Cache/ArrayCacheTest.php renamed to src/Cache/tests/ArrayCacheTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace React\Tests\Cache;
44

55
use React\Cache\ArrayCache;
6-
use React\Tests\Socket\TestCase;
76

87
class ArrayCacheTest extends TestCase
98
{

src/Cache/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\Cache;
4+
5+
class CallableStub
6+
{
7+
public function __invoke()
8+
{
9+
}
10+
}

src/Cache/tests/TestCase.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
namespace React\Tests\Cache;
4+
5+
class TestCase extends \PHPUnit_Framework_TestCase
6+
{
7+
protected function expectCallableExactly($amount)
8+
{
9+
$mock = $this->createCallableMock();
10+
$mock
11+
->expects($this->exactly($amount))
12+
->method('__invoke');
13+
14+
return $mock;
15+
}
16+
17+
protected function expectCallableOnce()
18+
{
19+
$mock = $this->createCallableMock();
20+
$mock
21+
->expects($this->once())
22+
->method('__invoke');
23+
24+
return $mock;
25+
}
26+
27+
protected function expectCallableNever()
28+
{
29+
$mock = $this->createCallableMock();
30+
$mock
31+
->expects($this->never())
32+
->method('__invoke');
33+
34+
return $mock;
35+
}
36+
37+
protected function createCallableMock()
38+
{
39+
return $this->getMock('React\Tests\Cache\CallableStub');
40+
}
41+
}

src/Cache/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\\Cache\\', __DIR__);

src/ChildProcess/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>

0 commit comments

Comments
 (0)