Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use SymfonyCasts\Bundle\ResetPassword\Persistence\ResetPasswordRequestRepositoryInterface;

/**
* @author Jesse Rushlow <jr@rushlow.dev>
Expand All @@ -33,6 +34,8 @@ public function load(array $configs, ContainerBuilder $container): void

$config = $this->processConfiguration($configuration, $configs);

$container->setAlias(ResetPasswordRequestRepositoryInterface::class, $config['request_password_repository']);

$helperDefinition = $container->getDefinition('symfonycasts.reset_password.helper');
$helperDefinition->replaceArgument(2, new Reference($config['request_password_repository']));
$helperDefinition->replaceArgument(3, $config['lifetime']);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/*
* This file is part of the SymfonyCasts ResetPasswordBundle package.
* Copyright (c) SymfonyCasts <https://symfonycasts.com/>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace SymfonyCasts\Bundle\ResetPassword\Tests\IntegrationTests;

use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use SymfonyCasts\Bundle\ResetPassword\Persistence\ResetPasswordRequestRepositoryInterface;
use SymfonyCasts\Bundle\ResetPassword\Tests\ResetPasswordTestKernel;

final class ResetPasswordRequestRepositoryInterfaceAutowireTest extends TestCase
{
public function testResetPasswordRequestRepositoryInterfaceIsAutowiredByContainer(): void
{
$builder = new ContainerBuilder();
$builder->autowire(ResetPasswordRequestRepositoryAutowireTest::class)
->setPublic(true)
;

$kernel = new ResetPasswordTestKernel($builder);
$kernel->boot();

$container = $kernel->getContainer();
$container->get(ResetPasswordRequestRepositoryAutowireTest::class);

$this->expectNotToPerformAssertions();
}
}

/**
* @internal
*/
final class ResetPasswordRequestRepositoryAutowireTest
{
public function __construct(ResetPasswordRequestRepositoryInterface $repository)
{
}
}