PageRenderTime 26ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/tests/units/classes/asserters/sizeOf.php

http://github.com/mageekguy/atoum
PHP | 55 lines | 47 code | 8 blank | 0 comment | 0 complexity | 2e171e2bf0afc1d39ff527778e9cfcdc MD5 | raw file
  1. <?php
  2. namespace mageekguy\atoum\tests\units\asserters;
  3. use
  4. mageekguy\atoum,
  5. mageekguy\atoum\asserter,
  6. mageekguy\atoum\tools\variable
  7. ;
  8. require_once __DIR__ . '/../../runner.php';
  9. class sizeOf extends atoum\test
  10. {
  11. public function testClass()
  12. {
  13. $this->testedClass->isSubclassOf('mageekguy\atoum\asserters\integer');
  14. }
  15. public function test__construct()
  16. {
  17. $this
  18. ->given($this->newTestedInstance)
  19. ->then
  20. ->object($this->testedInstance->getGenerator())->isEqualTo(new asserter\generator())
  21. ->object($this->testedInstance->getAnalyzer())->isEqualTo(new variable\analyzer())
  22. ->object($this->testedInstance->getLocale())->isEqualTo(new atoum\locale())
  23. ->variable($this->testedInstance->getValue())->isNull()
  24. ->boolean($this->testedInstance->wasSet())->isFalse()
  25. ->if($this->newTestedInstance($generator = new asserter\generator(), $analyzer = new variable\analyzer(), $locale = new atoum\locale()))
  26. ->then
  27. ->object($this->testedInstance->getGenerator())->isIdenticalTo($generator)
  28. ->object($this->testedInstance->getAnalyzer())->isIdenticalTo($analyzer)
  29. ->object($this->testedInstance->getLocale())->isIdenticalTo($locale)
  30. ->variable($this->testedInstance->getValue())->isNull()
  31. ->boolean($this->testedInstance->wasSet())->isFalse()
  32. ;
  33. }
  34. public function testSetWith()
  35. {
  36. $this
  37. ->if($this->newTestedInstance)
  38. ->then
  39. ->object($this->testedInstance->setWith(array()))->isTestedInstance
  40. ->boolean($this->testedInstance->wasSet())->isTrue()
  41. ->integer($this->testedInstance->getValue())->isZero()
  42. ->object($this->testedInstance->setWith($countable = range(1, rand(2, 5))))->isTestedInstance
  43. ->boolean($this->testedInstance->wasSet())->isTrue()
  44. ->integer($this->testedInstance->getValue())->isEqualTo(sizeof($countable))
  45. ;
  46. }
  47. }