LimeMockStateInterface.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of the Lime test framework.
  4. *
  5. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  6. * (c) Bernhard Schussek <bernhard.schussek@symfony-project.com>
  7. *
  8. * This source file is subject to the MIT license that is bundled
  9. * with this source code in the file LICENSE.
  10. */
  11. /**
  12. * Represents the current state of the mock.
  13. *
  14. * A mock can have different states during his lifetime. The functionality
  15. * in these different states is implemented using the State Pattern. Each
  16. * state should extend this interface.
  17. *
  18. * @package Lime
  19. * @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
  20. * @version SVN: $Id: LimeMockStateInterface.php 23880 2009-11-14 10:14:34Z bschussek $
  21. */
  22. interface LimeMockStateInterface
  23. {
  24. /**
  25. * Handles an invoked method on the mock.
  26. *
  27. * Depending on the state of the mock, invoked methods may be treated
  28. * differently.
  29. *
  30. * @param LimeMockInvocation $invocation
  31. * @return mixed
  32. * @throws LimeMockInvocationException
  33. * @throws Exception
  34. */
  35. public function invoke(LimeMockMethod $method, array $parameters = null);
  36. /**
  37. * Returns whether the given method is invokable.
  38. *
  39. * @param LimeMockMethod $method The method
  40. * @return boolean TRUE if the method is invokable
  41. */
  42. public function isInvokable(LimeMockMethod $method);
  43. /**
  44. * Tells the state that the mock should not receive any method invocation.
  45. */
  46. public function setExpectNothing();
  47. /**
  48. * Verifies the mock in the current state.
  49. */
  50. public function verify();
  51. }