Release 2.7.0 (#4506)
* added api URL for simpler integration * allow to request password change upon next login * make ModifiedAt timesheet independent * improved plugin api * replace kernel calls with AutoconfigureTag and TaggedIterator attributes * new translation keys (e.g. for days) * support setting min and max date on date and daterange pickers
This commit is contained in:
@@ -12,29 +12,27 @@ namespace App\Tests\Plugin;
|
||||
use App\Plugin\Plugin;
|
||||
use App\Plugin\PluginInterface;
|
||||
use App\Plugin\PluginManager;
|
||||
use App\Plugin\PluginMetadata;
|
||||
use App\Tests\Plugin\Fixtures\TestPlugin\TestPlugin;
|
||||
use App\Tests\Plugin\Fixtures\TestPlugin2\TestPlugin2;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
/**
|
||||
* @covers \App\Plugin\PluginManager
|
||||
* @covers \App\Plugin\Plugin
|
||||
* @covers \App\Plugin\PluginMetadata
|
||||
*/
|
||||
class PluginManagerTest extends TestCase
|
||||
{
|
||||
public function testEmptyObject()
|
||||
public function testEmptyObject(): void
|
||||
{
|
||||
$sut = new PluginManager([]);
|
||||
$this->assertEmpty($sut->getPlugins());
|
||||
$this->assertNull($sut->getPlugin('foo'));
|
||||
$this->assertFalse($sut->hasPlugin('foo'));
|
||||
}
|
||||
|
||||
public function testUnknownRendererReturnsNull()
|
||||
{
|
||||
$sut = new PluginManager([]);
|
||||
$this->assertNull($sut->getPlugin('foo'));
|
||||
}
|
||||
|
||||
public function testAdd()
|
||||
public function testAdd(): void
|
||||
{
|
||||
$plugin = $this->createMock(PluginInterface::class);
|
||||
$plugin->expects($this->any())->method('getName')->willReturn('foo');
|
||||
@@ -52,27 +50,23 @@ class PluginManagerTest extends TestCase
|
||||
// make sure a plugin with the same name is not added twice, the first one wins!
|
||||
$this->assertEquals(2, \count($sut->getPlugins()));
|
||||
|
||||
$this->assertFalse($sut->hasPlugin('bar'));
|
||||
$this->assertTrue($sut->hasPlugin('foo'));
|
||||
$foo = $sut->getPlugin('foo');
|
||||
$this->assertInstanceOf(Plugin::class, $foo);
|
||||
$this->assertEquals('foo', $foo->getName());
|
||||
$this->assertEquals('foo', $foo->getId());
|
||||
$this->assertEquals('bar', $foo->getPath());
|
||||
|
||||
$test = $sut->getPlugin('TestPlugin');
|
||||
$this->assertInstanceOf(Plugin::class, $test);
|
||||
$this->assertEquals('TestPlugin', $test->getName());
|
||||
$this->assertNull($test->getMetadata());
|
||||
}
|
||||
$this->assertEquals('TestPlugin', $test->getId());
|
||||
$this->assertEquals('TestPlugin from composer.json', $test->getName());
|
||||
$this->assertInstanceOf(PluginMetadata::class, $test->getMetadata());
|
||||
|
||||
public function testLoadMetadata()
|
||||
{
|
||||
$sut = new PluginManager([new TestPlugin()]);
|
||||
$plugin = $sut->getPlugin('TestPlugin');
|
||||
$sut->loadMetadata($plugin);
|
||||
|
||||
$meta = $plugin->getMetadata();
|
||||
$meta = $test->getMetadata();
|
||||
$this->assertEquals(10000, $meta->getKimaiVersion());
|
||||
$this->assertEquals('1.0', $meta->getVersion());
|
||||
$this->assertEquals('TestPlugin', $plugin->getId());
|
||||
$this->assertEquals('TestPlugin', $test->getId());
|
||||
$this->assertEquals('TestPlugin from composer.json', $meta->getName());
|
||||
$this->assertEquals('Just a test fixture for the PluginManager', $meta->getDescription());
|
||||
$this->assertEquals('https://github.com/kimai/kimai', $meta->getHomepage());
|
||||
|
||||
Reference in New Issue
Block a user