ErrorTest.php 2.5 KB

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