TestCase.php 891 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace React\Tests\EventLoop;
  3. class TestCase extends \PHPUnit_Framework_TestCase
  4. {
  5. protected function expectCallableExactly($amount)
  6. {
  7. $mock = $this->createCallableMock();
  8. $mock
  9. ->expects($this->exactly($amount))
  10. ->method('__invoke');
  11. return $mock;
  12. }
  13. protected function expectCallableOnce()
  14. {
  15. $mock = $this->createCallableMock();
  16. $mock
  17. ->expects($this->once())
  18. ->method('__invoke');
  19. return $mock;
  20. }
  21. protected function expectCallableNever()
  22. {
  23. $mock = $this->createCallableMock();
  24. $mock
  25. ->expects($this->never())
  26. ->method('__invoke');
  27. return $mock;
  28. }
  29. protected function createCallableMock()
  30. {
  31. return $this->getMockBuilder('React\Tests\EventLoop\CallableStub')->getMock();
  32. }
  33. }