LimeConstraintGreaterThanEqual.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. * Tests that a value is greater than or equal to another.
  13. *
  14. * @package Lime
  15. * @author Bernhard Schussek <bernhard.schussek@symfony-project.com>
  16. * @version SVN: $Id: LimeConstraintGreaterThanEqual.php 23701 2009-11-08 21:23:40Z bschussek $
  17. */
  18. class LimeConstraintGreaterThanEqual extends LimeConstraint
  19. {
  20. /**
  21. * (non-PHPdoc)
  22. * @see constraint/LimeConstraintInterface#evaluate($value)
  23. */
  24. public function evaluate($value)
  25. {
  26. try
  27. {
  28. LimeTester::create($value)->greaterThanEqual(LimeTester::create($this->expected));
  29. }
  30. catch (LimeAssertionFailedException $e)
  31. {
  32. throw new LimeConstraintException(sprintf(" %s\nis not >= %s", $e->getActual(), $e->getExpected()));
  33. }
  34. }
  35. }