/** * Tests whether adding a template has the desired effect. * * @return void */ public function testAddTemplate() { $this->fixture->setThemesPath(dirname(__FILE__) . '/../../../data/themes'); $this->fixture->addTemplate('default'); $this->assertGreaterThan(0, count($this->fixture->getTransformations()), 'Transformations should be added'); try { $this->fixture->addTemplate('wargarbl'); $this->fail('Expected an exception to be thrown when ' . 'supplying a non-existent template'); } catch (InvalidArgumentException $e) { // this is good; exception is thrown } catch (Exception $e) { $this->fail('An unknown exception has occurred when supplying a ' . 'non-existent template: ' . $e->getMessage()); } }
/** * Tests whether the loading of transformation is working as expected. * * @return void */ public function testLoadTransformations() { DocBlox_Core_Abstract::config()->transformations = array(); $this->fixture = new DocBlox_Transformer(); $this->assertEquals(0, count($this->fixture->getTransformations()), 'A transformer should not have transformations when initialized ' . 'with an empty configuration'); DocBlox_Core_Abstract::config()->transformations = array(new Zend_Config_Xml(<<<XML <?xml version="1.0"?> <transformation> <query>test1</query> <writer>Xsl</writer> <source>test3</source> <artifact>test4</artifact> </transformation> XML )); $this->fixture->loadTransformations(); $this->assertEquals(1, count($this->fixture->getTransformations()), 'When invoking the loadTransformations method with only a single ' . 'transformation in the configuration there should be only 1'); // TODO: add test to check if a transformation which is passed as // argument is added correctly // TODO: add test to check if a template's transformations which is // passed as argument is added correctly $this->markTestIncomplete(); }