-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
renamed bundle and refactored services #804
- Loading branch information
1 parent
6613b46
commit c079af9
Showing
12 changed files
with
209 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/PROCERGS/LoginCidadao/CpfVerificationBundle/Resources/config/routing.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
lc_cpf_verification: | ||
resource: "@PROCERGSLoginCidadaoCpfVerificationBundle/Controller/" | ||
resource: "@PROCERGSCpfVerificationBundle/Controller/" | ||
type: annotation | ||
prefix: / |
14 changes: 14 additions & 0 deletions
14
src/PROCERGS/LoginCidadao/CpfVerificationBundle/Resources/config/services.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,16 @@ | ||
services: | ||
procergs.nfg.cpf_verification.http_client: | ||
class: GuzzleHttp\Client | ||
arguments: | ||
- base_uri: "%procergs.nfg.cpf_verification.base_uri%" | ||
|
||
procergs.nfg.cpf_verification.http_service: | ||
class: PROCERGS\LoginCidadao\CpfVerificationBundle\Service\CpfVerificationHttpService | ||
arguments: | ||
- "@procergs.nfg.cpf_verification.http_client" | ||
- | ||
|
||
procergs.nfg.cpf_verification.service: | ||
class: PROCERGS\LoginCidadao\CpfVerificationBundle\Service\CpfVerificationService | ||
arguments: | ||
- "@procergs.nfg.cpf_verification.http_service" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...OCERGS/LoginCidadao/CpfVerificationBundle/Tests/DependencyInjection/ConfigurationTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* This file is part of the login-cidadao project or it's bundles. | ||
* | ||
* (c) Guilherme Donato <guilhermednt on github> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace PROCERGS\LoginCidadao\CpfVerificationBundle\Tests\DependencyInjection; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use PROCERGS\LoginCidadao\CpfVerificationBundle\DependencyInjection\Configuration; | ||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
use Symfony\Component\Config\Definition\Processor; | ||
|
||
class ConfigurationTest extends TestCase | ||
{ | ||
private const FULL_CONFIG = [ | ||
'base_uri' => 'https://example.com', | ||
'list_challenges_path' => 'challenges/list', | ||
'challenge_path' => 'challenges/get/:challenge', | ||
]; | ||
|
||
public function testGetConfigTreeBuilder() | ||
{ | ||
$configuration = new Configuration(); | ||
$this->assertInstanceOf(TreeBuilder::class, $configuration->getConfigTreeBuilder()); | ||
} | ||
|
||
public function testEmptyConfig() | ||
{ | ||
$this->expectException(\Exception::class); | ||
|
||
$processor = new Processor(); | ||
$processor->processConfiguration(new Configuration(), []); | ||
} | ||
|
||
public function testMinimalConfig() | ||
{ | ||
$processor = new Processor(); | ||
$config = $processor->processConfiguration(new Configuration(), [['base_uri' => 'https://example.com']]); | ||
|
||
$this->assertEquals([ | ||
'base_uri' => 'https://example.com', | ||
'list_challenges_path' => null, | ||
'challenge_path' => null, | ||
], $config); | ||
} | ||
|
||
public function testFullConfig() | ||
{ | ||
$processor = new Processor(); | ||
$config = $processor->processConfiguration(new Configuration(), [self::FULL_CONFIG]); | ||
|
||
$this->assertEquals(self::FULL_CONFIG, $config); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
.../CpfVerificationBundle/Tests/DependencyInjection/PROCERGSCpfVerificationExtensionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
/** | ||
* This file is part of the login-cidadao project or it's bundles. | ||
* | ||
* (c) Guilherme Donato <guilhermednt on github> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace PROCERGS\LoginCidadao\CpfVerificationBundle\Tests\DependencyInjection; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use PROCERGS\LoginCidadao\CpfVerificationBundle\DependencyInjection\PROCERGSCpfVerificationExtension; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; | ||
|
||
class PROCERGSCpfVerificationExtensionTest extends TestCase | ||
{ | ||
private function createContainer() | ||
{ | ||
$container = new ContainerBuilder( | ||
new ParameterBag( | ||
[ | ||
'kernel.cache_dir' => __DIR__, | ||
'kernel.root_dir' => __DIR__.'/Fixtures', | ||
'kernel.charset' => 'UTF-8', | ||
'kernel.debug' => false, | ||
] | ||
) | ||
); | ||
|
||
return $container; | ||
} | ||
|
||
private function compileContainer(ContainerBuilder $container) | ||
{ | ||
$container->getCompilerPassConfig()->setOptimizationPasses([]); | ||
$container->getCompilerPassConfig()->setRemovingPasses([]); | ||
$container->compile(); | ||
} | ||
|
||
public function testParametersLoaded() | ||
{ | ||
$container = $this->createContainer(); | ||
$container->registerExtension(new PROCERGSCpfVerificationExtension()); | ||
$container->loadFromExtension('procergs_cpf_verification', [ | ||
'base_uri' => 'https://example.com', | ||
'list_challenges_path' => 'challenges', | ||
'challenge_path' => 'challenges/challenge', | ||
]); | ||
$this->compileContainer($container); | ||
|
||
$endpoints = [ | ||
'listChallenges' => 'challenges', | ||
'challenge' => 'challenges/challenge', | ||
]; | ||
|
||
$this->assertEquals( | ||
'https://example.com', | ||
$container->getParameter('procergs.nfg.cpf_verification.base_uri') | ||
); | ||
$this->assertEquals( | ||
$endpoints, | ||
$container->getParameter('procergs.nfg.cpf_verification.options.endpoints') | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters