Store sessions in database (#1736)

This commit is contained in:
Kevin Papst
2020-06-11 16:54:51 +02:00
committed by GitHub
parent a75bdc52f6
commit ea4e930cbb
23 changed files with 507 additions and 20 deletions

View File

@@ -7,7 +7,7 @@
* file that was distributed with this source code.
*/
namespace App\Tests\Plugin\Fixtures;
namespace App\Tests\Plugin\Fixtures\TestPlugin;
use App\Plugin\PluginInterface;

View File

@@ -0,0 +1,31 @@
<?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\Plugin\Fixtures\TestPlugin2;
use App\Plugin\PluginInterface;
class TestPlugin2 implements PluginInterface
{
/**
* @return string
*/
public function getName()
{
return 'TestPlugin';
}
/**
* @return string
*/
public function getPath()
{
return __DIR__;
}
}

View File

@@ -13,7 +13,8 @@ use App\Plugin\Plugin;
use App\Plugin\PluginInterface;
use App\Plugin\PluginManager;
use App\Plugin\PluginMetadata;
use App\Tests\Plugin\Fixtures\TestPlugin;
use App\Tests\Plugin\Fixtures\TestPlugin\TestPlugin;
use App\Tests\Plugin\Fixtures\TestPlugin2\TestPlugin2;
use PHPUnit\Framework\TestCase;
/**
@@ -38,15 +39,13 @@ class PluginManagerTest extends TestCase
{
$sut = new PluginManager([]);
$plugin = $this->getMockBuilder(PluginInterface::class)
->onlyMethods(['getName', 'getPath'])
->getMock();
$plugin->method('getName')->willReturn('foo');
$plugin->method('getPath')->willReturn('bar');
$plugin = $this->createMock(PluginInterface::class);
$plugin->expects($this->any())->method('getName')->willReturn('foo');
$plugin->expects($this->any())->method('getPath')->willReturn('bar');
$sut->addPlugin(new TestPlugin());
$sut->addPlugin($plugin);
$sut->addPlugin(new TestPlugin2());
$sut->addPlugin(new TestPlugin());
// make sure a plugin with the same name is not added twice, the first one wins!