BooleanTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. /**
  3. * @package Zend_Pdf
  4. * @subpackage UnitTests
  5. */
  6. /**
  7. * Zend_Pdf_Element_Boolean
  8. */
  9. require_once 'Zend/Pdf/Element/Boolean.php';
  10. /**
  11. * PHPUnit Test Case
  12. */
  13. require_once 'PHPUnit/Framework/TestCase.php';
  14. /**
  15. * @package Zend_Pdf
  16. * @subpackage UnitTests
  17. */
  18. class Zend_Pdf_Element_BooleanTest extends PHPUnit_Framework_TestCase
  19. {
  20. public function testPDFBoolean()
  21. {
  22. $boolObj = new Zend_Pdf_Element_Boolean(false);
  23. $this->assertTrue($boolObj instanceof Zend_Pdf_Element_Boolean);
  24. }
  25. public function testPDFBooleanBadArgument()
  26. {
  27. try {
  28. $boolObj = new Zend_Pdf_Element_Boolean('some input');
  29. } catch (Zend_Pdf_Exception $e) {
  30. $this->assertRegExp('/must be boolean/i', $e->getMessage());
  31. return;
  32. }
  33. $this->fail('Expected Zend_Pdf_Exception to be thrown');
  34. }
  35. public function testGetType()
  36. {
  37. $boolObj = new Zend_Pdf_Element_Boolean((boolean) 100);
  38. $this->assertEquals($boolObj->getType(), Zend_Pdf_Element::TYPE_BOOL);
  39. }
  40. public function testToString()
  41. {
  42. $boolObj = new Zend_Pdf_Element_Boolean(true);
  43. $this->assertEquals($boolObj->toString(), 'true');
  44. }
  45. }