LimeTesterResource.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /*
  3. * This file is part of the Lime 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. class LimeTesterResource extends LimeTester
  12. {
  13. protected
  14. $type = 'resource';
  15. public function is(LimeTesterInterface $expected)
  16. {
  17. if ($this->value != $expected->value)
  18. {
  19. throw new LimeAssertionFailedException($this, $expected);
  20. }
  21. }
  22. public function isnt(LimeTesterInterface $expected)
  23. {
  24. if ($this->value == $expected->value)
  25. {
  26. throw new LimeAssertionFailedException($this, $expected);
  27. }
  28. }
  29. public function same(LimeTesterInterface $expected)
  30. {
  31. $this->is($expected);
  32. }
  33. public function isntSame(LimeTesterInterface $expected)
  34. {
  35. $this->isnt($expected);
  36. }
  37. public function __toString()
  38. {
  39. return sprintf('resource(%s) of type (%s)', (integer)$this->value, get_resource_type($this->value));
  40. }
  41. }