/**
  * Returns fixture by name.
  *
  * @param string $name Fixture name.
  *
  * @return string
  * @throws \InvalidArgumentException When fixture wasn't found.
  */
 protected function getFixture($name)
 {
     $fixture_filename = __DIR__ . '/fixtures/' . $this->plugin->getName() . '/' . $name;
     if (!file_exists($fixture_filename)) {
         throw new \InvalidArgumentException('The "' . $name . '" fixture does not exist.');
     }
     return new \SimpleXMLElement(file_get_contents($fixture_filename));
 }
Esempio n. 2
0
 /**
  * Registers a plugin.
  *
  * @param IPlugin $plugin Plugin.
  *
  * @return void
  * @throws \LogicException When plugin is registered several times.
  */
 public function registerPlugin(IPlugin $plugin)
 {
     $plugin_name = $plugin->getName();
     if ($this->pluginRegistered($plugin_name)) {
         throw new \LogicException('The "' . $plugin_name . '" revision log plugin is already registered.');
     }
     $plugin->setRevisionLog($this);
     $this->_plugins[$plugin_name] = $plugin;
 }