Skip to content

Commit

Permalink
Merge pull request #640 from tienvx/revert-auto-configuration
Browse files Browse the repository at this point in the history
Revert auto configuration
  • Loading branch information
tienvx authored Jul 26, 2022
2 parents ecefec2 + 71f565e commit e50699f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 0 additions & 3 deletions src/Plugin/PluginInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

namespace Tienvx\Bundle\MbtBundle\Plugin;

use Symfony\Component\DependencyInjection\Attribute\Autoconfigure;

#[Autoconfigure(tags: [PluginInterface::TAG], lazy: true)]
interface PluginInterface
{
public const TAG = 'mbt_bundle.plugin';
Expand Down
4 changes: 4 additions & 0 deletions src/TienvxMbtBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Symfony\Component\HttpKernel\Bundle\AbstractBundle;
use Tienvx\Bundle\MbtBundle\Command\CommandManager;
use Tienvx\Bundle\MbtBundle\DependencyInjection\Compiler\PluginPass;
use Tienvx\Bundle\MbtBundle\Plugin\PluginInterface;
use Tienvx\Bundle\MbtBundle\Service\SelenoidHelper;

class TienvxMbtBundle extends AbstractBundle
Expand Down Expand Up @@ -37,5 +38,8 @@ public function loadExtension(array $config, ContainerConfigurator $container, C
->get(CommandManager::class)
->call('setUploadDir', [$config[static::UPLOAD_DIR]])
;
$builder->registerForAutoconfiguration(PluginInterface::class)
->setLazy(true)
->addTag(PluginInterface::TAG);
}
}
4 changes: 4 additions & 0 deletions tests/TienvxMbtBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Tienvx\Bundle\MbtBundle\Command\CommandManager;
use Tienvx\Bundle\MbtBundle\DependencyInjection\Compiler\PluginPass;
use Tienvx\Bundle\MbtBundle\Plugin\PluginInterface;
use Tienvx\Bundle\MbtBundle\Service\SelenoidHelper;
use Tienvx\Bundle\MbtBundle\TienvxMbtBundle;

Expand Down Expand Up @@ -73,5 +74,8 @@ public function testLoadExtension(): void
$this->assertSame([
['setUploadDir', [static::CONFIG[TienvxMbtBundle::UPLOAD_DIR]]],
], $this->builder->findDefinition(CommandManager::class)->getMethodCalls());
$autoConfigured = $this->builder->getAutoconfiguredInstanceof()[PluginInterface::class];
$this->assertTrue($autoConfigured->hasTag(PluginInterface::TAG));
$this->assertTrue($autoConfigured->isLazy());
}
}

0 comments on commit e50699f

Please sign in to comment.