You've already forked gitea-bundle
Initial commit
This commit is contained in:
41
tests/DependencyInjection/ConfigurationTest.php
Normal file
41
tests/DependencyInjection/ConfigurationTest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magdev\GiteaBundle\Tests\DependencyInjection;
|
||||
|
||||
use Magdev\GiteaBundle\DependencyInjection\Configuration;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Config\Definition\Processor;
|
||||
|
||||
/**
|
||||
* @author Marco Grätsch <magdev3.0@gmail.com>
|
||||
*/
|
||||
class ConfigurationTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider configsProvider
|
||||
*/
|
||||
public function testConfig(array $configs): void
|
||||
{
|
||||
$config = (new Processor())->processConfiguration(new Configuration(), $configs);
|
||||
$this->assertSame('foo', $config['connections']['default']['token']);
|
||||
$this->assertSame('bar', $config['connections']['default']['baseurl']);
|
||||
}
|
||||
|
||||
public function configsProvider(): iterable
|
||||
{
|
||||
yield [
|
||||
[
|
||||
'magdev_gitea' => [
|
||||
'connections' => [
|
||||
'default' => [
|
||||
'token' => 'foo',
|
||||
'baseurl' => 'bar'
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
40
tests/DependencyInjection/MagdevGiteaExtensionTest.php
Normal file
40
tests/DependencyInjection/MagdevGiteaExtensionTest.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Magdev\GiteaBundle\Tests\DependencyInjection;
|
||||
|
||||
use Magdev\GiteaBundle\DependencyInjection\MagdevGiteaExtension;
|
||||
use OwenVoke\Gitea\Client;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
/**
|
||||
* @author Marco Grätsch <magdev3.0@gmail.com>
|
||||
*/
|
||||
class MagdevGiteaExtensionTest extends TestCase
|
||||
{
|
||||
public function testExtension(): void
|
||||
{
|
||||
$container = new ContainerBuilder();
|
||||
|
||||
(new MagdevGiteaExtension())->load([
|
||||
'magdev_gitea' => [
|
||||
'connections' => [
|
||||
'primary' => ['baseurl' => 'http://foo1', 'token' => 'bar1'],
|
||||
'secondary' => ['baseurl' => 'http://foo2', 'token' => 'bar2'],
|
||||
],
|
||||
],
|
||||
], $container);
|
||||
|
||||
$this->assertTrue($container->has('magdev.gitea.primary'));
|
||||
$this->assertTrue($container->has('magdev.gitea.secondary'));
|
||||
|
||||
$this->assertTrue($container->hasAlias(Client::class));
|
||||
$this->assertTrue($container->hasAlias(Client::class.' $primaryClient'));
|
||||
$this->assertTrue($container->hasAlias(Client::class.' $secondaryClient'));
|
||||
|
||||
$this->assertInstanceOf(Client::class, $container->get('magdev.gitea.primary'));
|
||||
$this->assertInstanceOf(Client::class, $container->get('magdev.gitea.secondary'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user