1<?php
2
3namespace React\Promise;
4
5class TestCase extends \PHPUnit_Framework_TestCase
6{
7    public 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    public function expectCallableOnce()
18    {
19        $mock = $this->createCallableMock();
20        $mock
21            ->expects($this->once())
22            ->method('__invoke');
23
24        return $mock;
25    }
26
27    public function expectCallableNever()
28    {
29        $mock = $this->createCallableMock();
30        $mock
31            ->expects($this->never())
32            ->method('__invoke');
33
34        return $mock;
35    }
36
37    public function createCallableMock()
38    {
39        return $this
40            ->getMockBuilder('React\\Promise\Stub\CallableStub')
41            ->getMock();
42    }
43}
44