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

Commit

Permalink
Merge remote-tracking branch 'weierophinney/hotfix/servicemanager-dup…
Browse files Browse the repository at this point in the history
…licate-services'
  • Loading branch information
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions test/FactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace ZendTest\Barcode;

use ReflectionClass;
use Zend\Barcode;
use Zend\Barcode\Renderer;
use Zend\Barcode\Object;
Expand Down Expand Up @@ -38,19 +39,21 @@ public function setUp()
// Set timezone to avoid "It is not safe to rely on the system's timezone settings."
// message if timezone is not set within php.ini
date_default_timezone_set('GMT');

// Reset plugin managers
$r = new ReflectionClass('Zend\Barcode\Barcode');

$rObjectPlugins = $r->getProperty('objectPlugins');
$rObjectPlugins->setAccessible(true);
$rObjectPlugins->setValue(null);

$rRendererPlugins = $r->getProperty('rendererPlugins');
$rRendererPlugins->setAccessible(true);
$rRendererPlugins->setValue(null);
}

public function tearDown()
{
$objectPlugins = Barcode\Barcode::getObjectPluginManager();
$objectPlugins->setService('code25', null);
$objectPlugins->setService('code39', null);
$objectPlugins->setService('error', null);

$rendererPlugins = Barcode\Barcode::getRendererPluginManager();
$rendererPlugins->setService('image', null);
$rendererPlugins->setService('pdf', null);

date_default_timezone_set($this->originaltimezone);
}

Expand All @@ -62,6 +65,9 @@ public function testMinimalFactory()
$this->assertTrue($renderer->getBarcode() instanceof Object\Code39);
}

/**
* @group fml
*/
public function testMinimalFactoryWithRenderer()
{
$renderer = Barcode\Barcode::factory('code39', 'pdf');
Expand Down

0 comments on commit 4fb6bdc

Please sign in to comment.