예제 #1
0
 /**
  * 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());
     }
 }
예제 #2
0
 /**
  * Tests whether adding a template has the desired effect.
  *
  * @return void
  */
 public function testAddTemplate()
 {
     $this->assertNotEmpty($this->fixture->getTransformations(), 'Initial state should not be an empty array');
     $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());
     }
     // nothing should happen when template does not contain transformations
     DocBlox_Core_Abstract::config()->templates->wargarbl = '';
     $count = count($this->fixture->getTransformations());
     $this->assertNull($this->fixture->addTemplate('wargarbl'), 'No erroneous actions should happen when adding an empty template');
     $this->assertEquals($count, count($this->fixture->getTransformations()), 'Transformation count should be unchanged');
 }