Skip to content

Commit

Permalink
Using autowiring in all services (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoreram authored Feb 28, 2020
1 parent c9a6dc0 commit edde102
Show file tree
Hide file tree
Showing 29 changed files with 2,688 additions and 2,416 deletions.
24 changes: 4 additions & 20 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,17 @@
version: 2
jobs:
test-php72:
test-php73:
docker:
- image: circleci/php:7.2-cli
- image: circleci/php:7.4-cli

working_directory: ~/project
steps:
- checkout

- run:
name: Install PHPUnit
command: |
composer require phpunit/phpunit:7.5.17 --prefer-dist --prefer-stable --prefer-lowest --no-suggest
- run:
name: Run tests / Symfony 3^3
command: |
php vendor/bin/phpunit
- run:
name: Run tests / Symfony 4^3
command: |
composer update -n --prefer-dist --prefer-stable --no-suggest
composer update -n --prefer-dist --prefer-lowest --no-suggest
php vendor/bin/phpunit
- run:
Expand All @@ -38,21 +28,15 @@ jobs:
steps:
- checkout

- run:
name: Install PHPUnit
command: |
composer require phpunit/phpunit:7.5.17 --prefer-dist --prefer-stable --prefer-lowest --no-suggest
- run:
name: Run tests / Symfony 5^0
command: |
composer update -n --prefer-dist --no-suggest
php vendor/bin/phpunit
workflows:
version: 2
test:
jobs:
- test-php72
- test-php73
- test-php74
3 changes: 2 additions & 1 deletion ApisearchBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use Apisearch\DependencyInjection\CompilerPass\RepositoryCompilerPass;
use Apisearch\DependencyInjection\CompilerPass\WriteTransformerCompilerPass;
use Mmoreram\BaseBundle\BaseBundle;
use Mmoreram\SymfonyBundleDependencies\DependentBundleInterface;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
Expand All @@ -29,7 +30,7 @@
/**
* Class ApisearchBundle.
*/
class ApisearchBundle extends BaseBundle
class ApisearchBundle extends BaseBundle implements DependentBundleInterface
{
/**
* Return a CompilerPass instance array.
Expand Down
5 changes: 5 additions & 0 deletions Command/AddTokenCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
*/
class AddTokenCommand extends WithAppRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:add-token';

/**
* Configures the current command.
*/
Expand Down
5 changes: 5 additions & 0 deletions Command/ConfigureIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
*/
class ConfigureIndexCommand extends IndexBasedCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:configure-index';

/**
* Dispatch domain event.
*
Expand Down
5 changes: 5 additions & 0 deletions Command/CreateIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
*/
class CreateIndexCommand extends IndexBasedCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:create-index';

/**
* Dispatch domain event.
*
Expand Down
5 changes: 5 additions & 0 deletions Command/DeleteIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
*/
class DeleteIndexCommand extends WithAppRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:delete-index';

/**
* Configures the current command.
*/
Expand Down
5 changes: 5 additions & 0 deletions Command/DeleteTokenCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
*/
class DeleteTokenCommand extends WithAppRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:delete-token';

/**
* Configures the current command.
*/
Expand Down
5 changes: 5 additions & 0 deletions Command/DeleteTokensCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
*/
class DeleteTokensCommand extends WithAppRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:delete-tokens';

/**
* Configures the current command.
*/
Expand Down
6 changes: 5 additions & 1 deletion Command/ExportIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@
*/
class ExportIndexCommand extends WithRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:export-index';

/**
* Configures the current command.
*/
protected function configure()
{
$this
->setName('apisearch:export-index')
->setDescription('Export your index')
->addArgument(
'app-name',
Expand Down
6 changes: 5 additions & 1 deletion Command/ImportIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@
*/
class ImportIndexCommand extends WithRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:import-index';

/**
* Configures the current command.
*/
protected function configure()
{
$this
->setName('apisearch:import-index')
->setDescription('Import your index')
->addArgument(
'app-name',
Expand Down
5 changes: 5 additions & 0 deletions Command/PrintIndicesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
*/
class PrintIndicesCommand extends WithAppRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:print-indices';

/**
* Configures the current command.
*/
Expand Down
5 changes: 5 additions & 0 deletions Command/PrintTokensCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
*/
class PrintTokensCommand extends WithAppRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:print-tokens';

/**
* Configures the current command.
*/
Expand Down
5 changes: 5 additions & 0 deletions Command/QueryCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
*/
class QueryCommand extends WithRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:query';

/**
* Configures the current command.
*/
Expand Down
5 changes: 5 additions & 0 deletions Command/ResetIndexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
*/
class ResetIndexCommand extends WithAppRepositoryBucketCommand
{
/**
* @var string
*/
protected static $defaultName = 'apisearch:reset-index';

/**
* Configures the current command.
*/
Expand Down
9 changes: 6 additions & 3 deletions DependencyInjection/ApisearchConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@

namespace Apisearch\DependencyInjection;

use Apisearch\App\MockAppRepository;
use Apisearch\Http\Retry;
use Apisearch\Repository\MockRepository;
use Apisearch\User\MockUserRepository;
use Mmoreram\BaseBundle\DependencyInjection\BaseConfiguration;
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;

Expand Down Expand Up @@ -93,23 +96,23 @@ protected function setupTree(ArrayNodeDefinition $rootNode)
->addDefaultsIfNotSet()
->children()
->scalarNode('repository_service')
->defaultValue('apisearch.repository_mock')
->defaultValue(MockRepository::class)
->end()
->end()
->end()
->arrayNode('app')
->addDefaultsIfNotSet()
->children()
->scalarNode('repository_service')
->defaultValue('apisearch.app_repository_mock')
->defaultValue(MockAppRepository::class)
->end()
->end()
->end()
->arrayNode('user')
->addDefaultsIfNotSet()
->children()
->scalarNode('repository_service')
->defaultValue('apisearch.user_repository_mock')
->defaultValue(MockUserRepository::class)
->end()
->end()
->end();
Expand Down
4 changes: 3 additions & 1 deletion DependencyInjection/CompilerPass/ExporterCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

namespace Apisearch\DependencyInjection\CompilerPass;

use Apisearch\Exporter\ExporterCollection;

/**
* Class ExporterCompilerPass.
*/
Expand All @@ -27,7 +29,7 @@ class ExporterCompilerPass extends TagCompilerPass
*/
public function getCollectorServiceName(): string
{
return 'apisearch.exporter_collection';
return ExporterCollection::class;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

namespace Apisearch\DependencyInjection\CompilerPass;

use Apisearch\Transformer\Transformer;

/**
* Class ReadTransformerCompilerPass.
*/
Expand All @@ -27,7 +29,7 @@ class ReadTransformerCompilerPass extends TagCompilerPass
*/
public function getCollectorServiceName(): string
{
return 'apisearch.transformer';
return Transformer::class;
}

/**
Expand Down
Loading

0 comments on commit edde102

Please sign in to comment.