ErrorTest.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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-2009 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. /**
  23. * Test helper
  24. */
  25. require_once dirname(__FILE__) . '/../../../TestHelper.php';
  26. require_once dirname(__FILE__) . '/TestCommon.php';
  27. require_once 'Zend/Barcode/Object/Error.php';
  28. /**
  29. * @category Zend
  30. * @package Zend_Barcode
  31. * @subpackage UnitTests
  32. * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
  33. * @license http://framework.zend.com/license/new-bsd New BSD License
  34. */
  35. class Zend_Barcode_Object_ErrorTest extends Zend_Barcode_Object_TestCommon
  36. {
  37. protected function _getBarcodeObject($options = null)
  38. {
  39. return new Zend_Barcode_Object_Error($options);
  40. }
  41. public function testType()
  42. {
  43. $this->assertSame('error', $this->_object->getType());
  44. }
  45. public function testSetText()
  46. {
  47. $this->_object->setText('This is an error text');
  48. $this->assertSame('This is an error text', $this->_object->getRawText());
  49. $this->assertSame('This is an error text', $this->_object->getText());
  50. $this->assertSame('This is an error text', $this->_object->getTextToDisplay());
  51. }
  52. public function testCheckGoodParams()
  53. {
  54. $this->_object->setText('This is an error text');
  55. $this->assertTrue($this->_object->checkParams());
  56. }
  57. public function testGetDefaultHeight()
  58. {
  59. $this->assertEquals(40, $this->_object->getHeight());
  60. }
  61. public function testGetDefaultWidth()
  62. {
  63. $this->assertEquals(400, $this->_object->getWidth());
  64. }
  65. public function testCompleteGeneration()
  66. {
  67. $this->_object->setText('This is an error text');
  68. $this->_object->draw();
  69. $instructions = $this->loadInstructionsFile('Error_errortext_instructions');
  70. $this->assertEquals($instructions, $this->_object->getInstructions());
  71. }
  72. }