File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,10 @@ final class ContainerRegistry
4848{
4949 private static ContainerInterface |null $ container = null ;
5050
51- public static function createContainer (): Container
51+ /** @param array<string, mixed> $definitions */
52+ public static function createContainer (array $ definitions = []): Container
5253 {
53- return new Container ([
54+ return new Container ($ definitions + [
5455 Transformer::class => create (Prefix::class),
5556 TemplateResolver::class => create (TemplateResolver::class),
5657 TranslatorInterface::class => autowire (BypassTranslator::class),
Original file line number Diff line number Diff line change 1111namespace Respect \Validation ;
1212
1313use PHPUnit \Framework \Attributes \CoversClass ;
14- use PHPUnit \Framework \Attributes \DoesNotPerformAssertions ;
1514use PHPUnit \Framework \Attributes \Group ;
1615use PHPUnit \Framework \Attributes \Test ;
1716use Respect \Validation \Test \TestCase ;
2120final class ContainerRegistryTest extends TestCase
2221{
2322 #[Test]
24- #[DoesNotPerformAssertions]
25- public function itTheCreatedContainerShouldBeAbleToProvideAnInstanceOfValidator (): void
23+ public function itShouldBeAbleToProvideAnInstanceOfValidator (): void
2624 {
2725 $ container = ContainerRegistry::createContainer ();
28- $ container ->get (ValidatorBuilder::class);
26+
27+ self ::assertNotNull ($ container ->get (ValidatorBuilder::class));
28+ }
29+
30+ #[Test]
31+ public function itShouldBeAbleToGiveDefinitionsToTheContainer (): void
32+ {
33+ $ container = ContainerRegistry::createContainer (['foo ' => 'bar ' ]);
34+
35+ self ::assertSame ('bar ' , $ container ->get ('foo ' ));
2936 }
3037
3138 #[Test]
You can’t perform that action at this time.
0 commit comments