/** * SingletonProvider constructor. * @param ClassProviderInterface $provider */ public function __construct(ClassProviderInterface $provider) { parent::__construct($provider); $this->provider = $provider; }
public function testSingletonProvider() { $injector = new Injector(null); /** @var ClassProvider $provider */ $provider = ClassProvider::init(Engine::class); $singletonProvider = new SingletonProvider($provider); $this->assertSame($singletonProvider->get($injector), $singletonProvider->get($injector)); }