forked from clue/php-sse-react
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCase.php
More file actions
32 lines (25 loc) · 818 Bytes
/
Copy pathTestCase.php
File metadata and controls
32 lines (25 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
namespace Clue\React\Tests\Sse;
use PHPUnit\Framework\TestCase as BaseTestCase;
require __DIR__ . '/../vendor/autoload.php';
class TestCase extends BaseTestCase
{
protected function expectCallableOnce()
{
$mock = $this->createCallableMock();
$mock
->expects($this->once())
->method('__invoke');
return $mock;
}
protected function createCallableMock()
{
if (method_exists('PHPUnit\Framework\MockObject\MockBuilder', 'addMethods')) {
// PHPUnit 9+
return $this->getMockBuilder('stdClass')->addMethods(array('__invoke'))->getMock();
} else {
// legacy PHPUnit 4 - PHPUnit 8
return $this->getMockBuilder('stdClass')->setMethods(array('__invoke'))->getMock();
}
}
}