From: Gunnar Wrobel Date: Thu, 9 Dec 2010 10:02:52 +0000 (+0100) Subject: Change factory handling. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=237e83866f06e2345c51babf54e743fad7437a66;p=horde.git Change factory handling. --- diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php index 21238bae6..561f918ca 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/EventTest.php @@ -42,7 +42,7 @@ extends Horde_Kolab_Format_TestCase */ public function testIssue3525() { - $xml = $this->factory('XML', 'event'); + $xml = $this->getFactory()->create('XML', 'event'); // Load XML $event = file_get_contents(dirname(__FILE__) diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php index 883562cbc..656ec06c3 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/MimeAttrTest.php @@ -42,7 +42,7 @@ extends Horde_Kolab_Format_TestCase */ public function testGetName() { - $format = $this->factory('XML', 'contact'); + $format = $this->getFactory()->create('XML', 'contact'); $this->assertEquals('kolab.xml', $format->getName()); } @@ -53,7 +53,7 @@ extends Horde_Kolab_Format_TestCase */ public function testMimeType() { - $format = $this->factory('XML', 'contact'); + $format = $this->getFactory()->create('XML', 'contact'); $this->assertEquals('application/x-vnd.kolab.contact', $format->getMimeType()); } @@ -65,7 +65,7 @@ extends Horde_Kolab_Format_TestCase */ public function testGetDisposition() { - $format = $this->factory('XML', 'contact'); + $format = $this->getFactory()->create('XML', 'contact'); $this->assertEquals('attachment', $format->getDisposition()); } } diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php index 0cb5dd6d6..91d7e71b0 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/RecurrenceTest.php @@ -63,13 +63,13 @@ extends Horde_Kolab_Format_TestCase */ public function testBug6388() { - $xml = $this->factory('XML', 'event'); + $xml = $this->getFactory()->create('XML', 'event'); // Load XML $recur = file_get_contents(dirname(__FILE__) . '/fixtures/recur.xml'); // Load XML - $xml = $this->factory('XML', 'event'); + $xml = $this->getFactory()->create('XML', 'event'); $recur = file_get_contents(dirname(__FILE__) . '/fixtures/recur_fail.xml'); // Check that the xml fails because of a missing interval value @@ -89,7 +89,7 @@ extends Horde_Kolab_Format_TestCase */ public function testExceptions() { - $xml = $this->factory('XML', 'event'); + $xml = $this->getFactory()->create('XML', 'event'); // Load XML $recur = file_get_contents(dirname(__FILE__) . '/fixtures/recur.xml'); @@ -122,7 +122,7 @@ extends Horde_Kolab_Format_TestCase */ public function testCompletions() { - $xml = $this->factory('XML', 'event'); + $xml = $this->getFactory()->create('XML', 'event'); $r = new Horde_Date_Recurrence(0); $r->setRecurType(Horde_Date_Recurrence::RECUR_DAILY); diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/TaskTest.php b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/TaskTest.php index 0231a8a78..8f1c52460 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/TaskTest.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/Integration/TaskTest.php @@ -41,7 +41,7 @@ extends Horde_Kolab_Format_TestCase */ public function testBasicTask() { - $xml = $this->factory('XML', 'task'); + $xml = $this->getFactory()->create('XML', 'task'); // Load XML $task = file_get_contents(dirname(__FILE__) . '/../fixtures/task.xml'); diff --git a/framework/Kolab_Format/test/Horde/Kolab/Format/TestCase.php b/framework/Kolab_Format/test/Horde/Kolab/Format/TestCase.php index 818848ca0..3993ba17d 100644 --- a/framework/Kolab_Format/test/Horde/Kolab/Format/TestCase.php +++ b/framework/Kolab_Format/test/Horde/Kolab/Format/TestCase.php @@ -30,10 +30,13 @@ class Horde_Kolab_Format_TestCase extends PHPUnit_Framework_TestCase { - public function factory( - $format_type = '', $object_type = '', $params = null - ) { - $factory = new Horde_Kolab_Format_Factory(); - return $factory->create($format_type, $object_type, $params); + private $_factory; + + protected function getFactory() + { + if ($this->_factory === null) { + $this->_factory = new Horde_Kolab_Format_Factory(); + } + return $this->_factory; } }