LimeMockInvocationMatcherAtLeastOnce.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. * Requires a method call to be invoked once or more.
  13. *
  14. * @package Lime
  15. * @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
  16. * @version SVN: $Id: LimeMockInvocationMatcherAtLeastOnce.php 23701 2009-11-08 21:23:40Z bschussek $
  17. * @see LimeMockInvocationMatcherInterface
  18. */
  19. class LimeMockInvocationMatcherAtLeastOnce implements LimeMockInvocationMatcherInterface
  20. {
  21. private
  22. $actual = 0;
  23. /**
  24. * (non-PHPdoc)
  25. * @see mock/matcher/LimeMockInvocationMatcherInterface#invoke($invocation)
  26. */
  27. public function invoke(LimeMockInvocation $invocation)
  28. {
  29. $this->actual++;
  30. return true;
  31. }
  32. /**
  33. * (non-PHPdoc)
  34. * @see mock/matcher/LimeMockInvocationMatcherInterface#isInvokable()
  35. */
  36. public function isInvokable()
  37. {
  38. return true;
  39. }
  40. /**
  41. * (non-PHPdoc)
  42. * @see mock/matcher/LimeMockInvocationMatcherInterface#isSatisfied()
  43. */
  44. public function isSatisfied()
  45. {
  46. return $this->actual >= 1;
  47. }
  48. /**
  49. * (non-PHPdoc)
  50. * @see mock/matcher/LimeMockInvocationMatcherInterface#getMessage()
  51. */
  52. public function getMessage()
  53. {
  54. return 'at least once';
  55. }
  56. }