diff --git a/src/ContainerAwareTrait.php b/src/ContainerAwareTrait.php index 932cbc6..5e55406 100644 --- a/src/ContainerAwareTrait.php +++ b/src/ContainerAwareTrait.php @@ -1,16 +1,18 @@ container = $container; } - private function getContainer(): Container { + protected function getContainer(): Container + { return $this->container; } } diff --git a/tests/ContainerAwareTraitTest.php b/tests/ContainerAwareTraitTest.php new file mode 100644 index 0000000..2e450e0 --- /dev/null +++ b/tests/ContainerAwareTraitTest.php @@ -0,0 +1,15 @@ +produce(SubclassConsumer::class); + $this->assertSame($container, $subclassConsumer->getService(), 'Subclass must inherit auto declare trait'); + } +} diff --git a/tests/ParentConsumer.php b/tests/ParentConsumer.php new file mode 100644 index 0000000..c0615f8 --- /dev/null +++ b/tests/ParentConsumer.php @@ -0,0 +1,12 @@ +getContainer(); + } +}