Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #36 from remicollet/issue-php72
Browse files Browse the repository at this point in the history
Fix for php72 (object is a reserved keyword)
  • Loading branch information
weierophinney committed Dec 11, 2017
2 parents c882d0b + 70c2981 commit 3f3cb15
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/Renderer/AbstractRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Traversable;
use Zend\Barcode\Barcode;
use Zend\Barcode\Exception as BarcodeException;
use Zend\Barcode\Object;
use Zend\Barcode\Object\ObjectInterface;
use Zend\Stdlib\ArrayUtils;

/**
Expand Down Expand Up @@ -327,7 +327,7 @@ public function getAutomaticRenderError()
* @param Object\ObjectInterface $barcode
* @return AbstractRenderer
*/
public function setBarcode(Object\ObjectInterface $barcode)
public function setBarcode(ObjectInterface $barcode)
{
$this->barcode = $barcode;
return $this;
Expand Down
8 changes: 4 additions & 4 deletions test/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Zend\Barcode;
use Zend\Barcode\Exception\InvalidArgumentException;
use Zend\Barcode\Renderer;
use Zend\Barcode\Object;
use Zend\Barcode\Object\Code25;
use Zend\Config\Config;
use Zend\ServiceManager\Exception\InvalidServiceException;
use ZendPdf as Pdf;
Expand Down Expand Up @@ -159,14 +159,14 @@ public function testFactoryWithoutBarcodeWithAutomaticExceptionRenderWithZendCon
public function testFactoryWithExistingBarcodeObject()
{
$this->checkGDRequirement();
$barcode = new Object\Code25();
$barcode = new Code25();
$renderer = Barcode\Barcode::factory($barcode);
$this->assertSame($barcode, $renderer->getBarcode());
}

public function testBarcodeObjectFactoryWithExistingBarcodeObject()
{
$barcode = new Object\Code25();
$barcode = new Code25();
$generatedBarcode = Barcode\Barcode::makeBarcode($barcode);
$this->assertSame($barcode, $generatedBarcode);
}
Expand Down Expand Up @@ -411,7 +411,7 @@ public function testProxyBarcodeRendererDrawAsSvgAutomaticallyRenderSvgIfExcepti
public function testProxyBarcodeObjectFont()
{
Barcode\Barcode::setBarcodeFont('my_font.ttf');
$barcode = new Object\Code25();
$barcode = new Code25();
$this->assertSame('my_font.ttf', $barcode->getFont());
Barcode\Barcode::setBarcodeFont('');
}
Expand Down
32 changes: 16 additions & 16 deletions test/Renderer/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace ZendTest\Barcode\Renderer;

use Zend\Barcode;
use Zend\Barcode\Object;
use Zend\Barcode\Object\Code39;
use Zend\Barcode\Renderer as RendererNS;

/**
Expand Down Expand Up @@ -99,7 +99,7 @@ public function testNonAllowedImageType()
public function testDrawReturnResource()
{
$this->checkTTFRequirement();
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->renderer->setBarcode($barcode);
$resource = $this->renderer->draw();
$this->assertInternalType('resource', $resource, 'Image must be a resource');
Expand All @@ -109,7 +109,7 @@ public function testDrawReturnResource()
public function testDrawWithExistantResourceReturnResource()
{
$this->checkTTFRequirement();
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->renderer->setBarcode($barcode);
$imageResource = imagecreatetruecolor(500, 500);
$this->renderer->setResource($imageResource);
Expand All @@ -121,7 +121,7 @@ public function testDrawWithExistantResourceReturnResource()

public function testGoodUserHeight()
{
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$this->renderer->setBarcode($barcode);
$this->renderer->setHeight(62);
Expand All @@ -131,7 +131,7 @@ public function testGoodUserHeight()
public function testBadUserHeightLessThanBarcodeHeight()
{
$this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface');
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$this->renderer->setBarcode($barcode);
$this->renderer->setHeight(61);
Expand All @@ -140,7 +140,7 @@ public function testBadUserHeightLessThanBarcodeHeight()

public function testGoodUserWidth()
{
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$this->renderer->setBarcode($barcode);
$this->renderer->setWidth(211);
Expand All @@ -150,7 +150,7 @@ public function testGoodUserWidth()
public function testBadUserWidthLessThanBarcodeWidth()
{
$this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface');
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$this->renderer->setBarcode($barcode);
$this->renderer->setWidth(210);
Expand All @@ -159,7 +159,7 @@ public function testBadUserWidthLessThanBarcodeWidth()

public function testGoodHeightOfUserResource()
{
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$imageResource = imagecreatetruecolor(500, 62);
$this->renderer->setResource($imageResource);
Expand All @@ -170,7 +170,7 @@ public function testGoodHeightOfUserResource()
public function testBadHeightOfUserResource()
{
$this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface');
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$this->renderer->setBarcode($barcode);
$imageResource = imagecreatetruecolor(500, 61);
Expand All @@ -180,7 +180,7 @@ public function testBadHeightOfUserResource()

public function testGoodWidthOfUserResource()
{
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$imageResource = imagecreatetruecolor(211, 500);
$this->renderer->setResource($imageResource);
Expand All @@ -191,7 +191,7 @@ public function testGoodWidthOfUserResource()
public function testBadWidthOfUserResource()
{
$this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface');
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$this->renderer->setBarcode($barcode);
$imageResource = imagecreatetruecolor(210, 500);
Expand All @@ -203,7 +203,7 @@ public function testNoFontWithOrientation()
{
$this->setExpectedException('\Zend\Barcode\Renderer\Exception\ExceptionInterface');
Barcode\Barcode::setBarcodeFont(null);
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$barcode->setOrientation(1);
$this->renderer->setBarcode($barcode);
$this->renderer->draw();
Expand Down Expand Up @@ -281,7 +281,7 @@ public function testTopOffsetOverrideVerticalPosition()
*/
public function testImageGifWithNoTransparency()
{
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->renderer->setBarcode($barcode);

$this->renderer->setTransparentBackground(false);
Expand All @@ -299,7 +299,7 @@ public function testImageGifWithNoTransparency()
*/
public function testImagePngWithNoTransparency()
{
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->renderer->setBarcode($barcode);

$this->renderer->setTransparentBackground(false);
Expand All @@ -317,7 +317,7 @@ public function testImagePngWithNoTransparency()
*/
public function testImageGifWithTransparency()
{
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->renderer->setBarcode($barcode);

$this->renderer->setTransparentBackground(true);
Expand All @@ -335,7 +335,7 @@ public function testImageGifWithTransparency()
*/
public function testImagePngWithTransparency()
{
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->renderer->setBarcode($barcode);

$this->renderer->setTransparentBackground(true);
Expand Down
14 changes: 7 additions & 7 deletions test/Renderer/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use ZendPdf as Pdf;
use Zend\Barcode;
use Zend\Barcode\Object;
use Zend\Barcode\Object\Code39;

/**
* @group Zend_Barcode
Expand Down Expand Up @@ -45,7 +45,7 @@ public function testGoodPdfResource()
public function testDrawReturnResource()
{
Barcode\Barcode::setBarcodeFont(__DIR__ . '/../Object/_fonts/Vera.ttf');
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->renderer->setBarcode($barcode);
$resource = $this->renderer->draw();
$this->assertInstanceOf('ZendPdf\PdfDocument', $resource);
Expand All @@ -55,7 +55,7 @@ public function testDrawReturnResource()
public function testDrawWithExistantResourceReturnResource()
{
Barcode\Barcode::setBarcodeFont(__DIR__ . '/../Object/_fonts/Vera.ttf');
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->renderer->setBarcode($barcode);
$pdfResource = new Pdf\PdfDocument();
$this->renderer->setResource($pdfResource);
Expand All @@ -75,7 +75,7 @@ protected function getRendererWithWidth500AndHeight300()
public function testHorizontalPositionToCenter()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$renderer->setBarcode($barcode);
$renderer->setHorizontalPosition('center');
Expand All @@ -86,7 +86,7 @@ public function testHorizontalPositionToCenter()
public function testHorizontalPositionToRight()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$renderer->setBarcode($barcode);
$renderer->setHorizontalPosition('right');
Expand All @@ -97,7 +97,7 @@ public function testHorizontalPositionToRight()
public function testVerticalPositionToMiddle()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$renderer->setBarcode($barcode);
$renderer->setVerticalPosition('middle');
Expand All @@ -108,7 +108,7 @@ public function testVerticalPositionToMiddle()
public function testVerticalPositionToBottom()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$renderer->setBarcode($barcode);
$renderer->setVerticalPosition('bottom');
Expand Down
20 changes: 10 additions & 10 deletions test/Renderer/TestCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use ZendTest\Barcode\Object\TestAsset as TestAsset;
use Zend\Barcode;
use Zend\Barcode\Object;
use Zend\Barcode\Object\Code39;
use Zend\Config;

abstract class TestCommon extends \PHPUnit_Framework_TestCase
Expand Down Expand Up @@ -51,7 +51,7 @@ public function tearDown()

public function testSetBarcodeObject()
{
$barcode = new Object\Code39();
$barcode = new Code39();
$this->renderer->setBarcode($barcode);
$this->assertSame($barcode, $this->renderer->getBarcode());
}
Expand Down Expand Up @@ -200,7 +200,7 @@ public function testHorizontalPositionToLeft()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$renderer->setModuleSize(1);
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$renderer->setBarcode($barcode);
$renderer->draw();
Expand All @@ -211,7 +211,7 @@ public function testHorizontalPositionToCenter()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$renderer->setModuleSize(1);
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$renderer->setBarcode($barcode);
$renderer->setHorizontalPosition('center');
Expand All @@ -223,7 +223,7 @@ public function testHorizontalPositionToRight()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$renderer->setModuleSize(1);
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$renderer->setBarcode($barcode);
$renderer->setHorizontalPosition('right');
Expand All @@ -235,7 +235,7 @@ public function testLeftOffsetOverrideHorizontalPosition()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$renderer->setModuleSize(1);
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(211, $barcode->getWidth());
$renderer->setBarcode($barcode);
$renderer->setLeftOffset(12);
Expand All @@ -248,7 +248,7 @@ public function testVerticalPositionToTop()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$renderer->setModuleSize(1);
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$renderer->setBarcode($barcode);
$renderer->setVerticalPosition('top');
Expand All @@ -260,7 +260,7 @@ public function testVerticalPositionToMiddle()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$renderer->setModuleSize(1);
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$renderer->setBarcode($barcode);
$renderer->setVerticalPosition('middle');
Expand All @@ -272,7 +272,7 @@ public function testVerticalPositionToBottom()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$renderer->setModuleSize(1);
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$renderer->setBarcode($barcode);
$renderer->setVerticalPosition('bottom');
Expand All @@ -284,7 +284,7 @@ public function testTopOffsetOverrideVerticalPosition()
{
$renderer = $this->getRendererWithWidth500AndHeight300();
$renderer->setModuleSize(1);
$barcode = new Object\Code39(['text' => '0123456789']);
$barcode = new Code39(['text' => '0123456789']);
$this->assertEquals(62, $barcode->getHeight());
$renderer->setBarcode($barcode);
$renderer->setTopOffset(12);
Expand Down

0 comments on commit 3f3cb15

Please sign in to comment.