private function formatPlugin(InputInterface $input, Plugin $plugin) { if ($input->getOption('json')) { return ['name' => $plugin->getName(), 'version' => $plugin->getManifest()->getVersion(), 'description' => $plugin->getManifest()->getDescription(), 'error' => false]; } return [$plugin->getName(), $plugin->getManifest()->getVersion(), $plugin->getManifest()->getDescription()]; }
public function testGetters() { $manifest = $this->createManifestMock(); $error = $this->getMock('Alchemy\\Phrasea\\Plugin\\Exception\\PluginValidationException'); $plugin = new Plugin('toto', $manifest, null); $this->assertSame('toto', $plugin->getName()); $this->assertSame($manifest, $plugin->getManifest()); $this->assertNull($plugin->getError()); $this->assertFalse($plugin->isErroneous()); $plugin = new Plugin('toto', null, $error); $this->assertSame('toto', $plugin->getName()); $this->assertNull($plugin->getManifest()); $this->assertSame($error, $plugin->getError()); $this->assertTrue($plugin->isErroneous()); }