ErrorTest.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * Zend Framework
  4. *
  5. * LICENSE
  6. *
  7. * This source file is subject to the new BSD license that is bundled
  8. * with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://framework.zend.com/license/new-bsd
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to license@zend.com so we can send you a copy immediately.
  14. *
  15. * @category Zend
  16. * @package Zend_Barcode
  17. * @subpackage UnitTests
  18. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @license http://framework.zend.com/license/new-bsd New BSD License
  20. * @version $Id$
  21. */
  22. require_once dirname(__FILE__) . '/TestCommon.php';
  23. require_once 'Zend/Barcode/Object/Error.php';
  24. /**
  25. * @category Zend
  26. * @package Zend_Barcode
  27. * @subpackage UnitTests
  28. * @group Zend_Barcode
  29. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. class Zend_Barcode_Object_ErrorTest extends Zend_Barcode_Object_TestCommon
  33. {
  34. protected function _getBarcodeObject($options = null)
  35. {
  36. return new Zend_Barcode_Object_Error($options);
  37. }
  38. public function testType()
  39. {
  40. $this->assertSame('error', $this->_object->getType());
  41. }
  42. public function testSetText()
  43. {
  44. $this->_object->setText('This is an error text');
  45. $this->assertSame('This is an error text', $this->_object->getRawText());
  46. $this->assertSame('This is an error text', $this->_object->getText());
  47. $this->assertSame('This is an error text', $this->_object->getTextToDisplay());
  48. }
  49. public function testCheckGoodParams()
  50. {
  51. $this->_object->setText('This is an error text');
  52. $this->assertTrue($this->_object->checkParams());
  53. }
  54. public function testGetDefaultHeight()
  55. {
  56. $this->assertEquals(40, $this->_object->getHeight());
  57. }
  58. public function testGetDefaultWidth()
  59. {
  60. $this->assertEquals(400, $this->_object->getWidth());
  61. }
  62. public function testCompleteGeneration()
  63. {
  64. $this->_object->setText('This is an error text');
  65. $this->_object->draw();
  66. $instructions = $this->loadInstructionsFile('Error_errortext_instructions');
  67. $this->assertEquals($instructions, $this->_object->getInstructions());
  68. }
  69. }