better support for installing plugins via composer (#5112)
* merge installation and update commands * generate metadata from array * new command to list available packages * added a management script to simplify updates * added directory for dev files * helper functions for installation and listing of packages * run plugin database installers
This commit is contained in:
@@ -29,8 +29,7 @@ class InstallCommandTest extends KernelTestCase
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
$this->application->add(new InstallCommand(
|
||||
$container->get('doctrine')->getConnection(),
|
||||
$this->application->getKernel()->getEnvironment()
|
||||
$container->get('doctrine')->getConnection()
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
namespace App\Tests\Command;
|
||||
|
||||
use App\Command\PluginCommand;
|
||||
use App\Plugin\PackageManager;
|
||||
use App\Plugin\PluginInterface;
|
||||
use App\Plugin\PluginManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
@@ -41,7 +42,7 @@ class PluginCommandTest extends KernelTestCase
|
||||
{
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$this->application->add(new PluginCommand(new PluginManager($plugins)));
|
||||
$this->application->add(new PluginCommand(new PluginManager($plugins), new PackageManager(__DIR__ . '/../../')));
|
||||
|
||||
$command = $this->application->find('kimai:plugins');
|
||||
$commandTester = new CommandTester($command);
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Tests\Command;
|
||||
|
||||
use App\Command\UpdateCommand;
|
||||
use App\Constants;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
|
||||
/**
|
||||
* @covers \App\Command\UpdateCommand
|
||||
* @group integration
|
||||
*/
|
||||
class UpdateCommandTest extends KernelTestCase
|
||||
{
|
||||
private Application $application;
|
||||
|
||||
protected function getCommand(): Command
|
||||
{
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
$this->application->add(new UpdateCommand(
|
||||
$container->get('doctrine')->getConnection(),
|
||||
$this->application->getKernel()->getEnvironment()
|
||||
));
|
||||
|
||||
return $this->application->find('kimai:update');
|
||||
}
|
||||
|
||||
public function testFullRun(): void
|
||||
{
|
||||
$command = $this->getCommand();
|
||||
$commandTester = new CommandTester($command);
|
||||
$commandTester->setInputs(['no']);
|
||||
$commandTester->execute([
|
||||
'command' => $command->getName(),
|
||||
]);
|
||||
|
||||
$result = $commandTester->getDisplay();
|
||||
|
||||
self::assertStringContainsString('Kimai updates running', $result);
|
||||
// make sure migrations run always
|
||||
self::assertStringContainsString('[OK] Already at the latest version ("DoctrineMigrations\\', $result);
|
||||
|
||||
self::assertStringContainsString(
|
||||
\sprintf('[OK] Congratulations! Successfully updated Kimai to version %s', Constants::VERSION),
|
||||
$result
|
||||
);
|
||||
|
||||
self::assertEquals(0, $commandTester->getStatusCode());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user