예제 #1
1
파일: ImageTest.php 프로젝트: haoyanfei/zf2
 public function testNoFontWithOrientation()
 {
     $this->setExpectedException('\\Zend\\Barcode\\Renderer\\Exception\\ExceptionInterface');
     Barcode\Barcode::setBarcodeFont(null);
     $barcode = new Object\Code39(array('text' => '0123456789'));
     $barcode->setOrientation(1);
     $this->renderer->setBarcode($barcode);
     $this->renderer->draw();
 }
예제 #2
0
 public function tearDown()
 {
     Barcode\Barcode::setBarcodeFont(null);
     if (!empty($this->originaltimezone)) {
         date_default_timezone_set($this->originaltimezone);
     }
 }
예제 #3
0
파일: TestCommon.php 프로젝트: stunti/zf2
 public function testStaticFontAsNumber()
 {
     for ($i = 1; $i < 5; $i++) {
         Barcode\Barcode::setBarcodeFont($i);
         $this->assertEquals('', $this->_object->getFont());
         $object = $this->_getBarcodeObject();
         $this->assertEquals($i, $object->getFont());
         Barcode\Barcode::setBarcodeFont('');
     }
 }
예제 #4
0
 public function testDrawWithExistantResourceReturnResource()
 {
     Barcode\Barcode::setBarcodeFont(__DIR__ . '/../Object/_fonts/Vera.ttf');
     $barcode = new Object\Code39(array('text' => '0123456789'));
     $this->renderer->setBarcode($barcode);
     $pdfResource = new Pdf\PdfDocument();
     $this->renderer->setResource($pdfResource);
     $resource = $this->renderer->draw();
     $this->assertTrue($resource instanceof Pdf\PdfDocument);
     $this->assertSame($resource, $pdfResource);
     Barcode\Barcode::setBarcodeFont('');
 }
예제 #5
0
 public function testDrawWithExistantResourceReturnResource()
 {
     Barcode\Barcode::setBarcodeFont(__DIR__ . '/../Object/_fonts/Vera.ttf');
     $barcode = new Code39(array('text' => '0123456789'));
     $this->_renderer->setBarcode($barcode);
     $svgResource = new \DOMDocument();
     $rootElement = $svgResource->createElement('svg');
     $rootElement->setAttribute('xmlns', "http://www.w3.org/2000/svg");
     $rootElement->setAttribute('version', '1.1');
     $rootElement->setAttribute('width', 500);
     $rootElement->setAttribute('height', 300);
     $svgResource->appendChild($rootElement);
     $this->_renderer->setResource($svgResource);
     $resource = $this->_renderer->draw();
     $this->assertTrue($resource instanceof \DOMDocument);
     $this->assertSame($resource, $svgResource);
     Barcode\Barcode::setBarcodeFont('');
 }
예제 #6
0
 public function testProxyBarcodeObjectFont()
 {
     Barcode\Barcode::setBarcodeFont('my_font.ttf');
     $barcode = new Object\Code25();
     $this->assertSame('my_font.ttf', $barcode->getFont());
     Barcode\Barcode::setBarcodeFont('');
 }
예제 #7
0
 public function tearDown()
 {
     Barcode\Barcode::setBarcodeFont(null);
 }
예제 #8
0
 public function tearDown()
 {
     Barcode\Barcode::setBarcodeFont(null);
     date_default_timezone_set($this->_originaltimezone);
 }
예제 #9
0
파일: ImageTest.php 프로젝트: stunti/zf2
 /**
  * @expectedException \Zend\Barcode\Renderer\Exception
  */
 public function testNoFontWithOrientation()
 {
     Barcode\Barcode::setBarcodeFont(null);
     $barcode = new Object\Code39(array('text' => '0123456789'));
     $barcode->setOrientation(1);
     $this->_renderer->setBarcode($barcode);
     $this->_renderer->draw();
 }