factory = new CacheFactory(); $this->sm = new ServiceManager(['services' => [ AppOptions::class => new AppOptions(), ]]); } public static function tearDownAfterClass(): void { putenv('APP_ENV'); } /** @test */ public function productionReturnsApcAdapter(): void { putenv('APP_ENV=pro'); $instance = ($this->factory)($this->sm, ''); $this->assertInstanceOf(ApcuCache::class, $instance); } /** @test */ public function developmentReturnsArrayAdapter(): void { putenv('APP_ENV=dev'); $instance = ($this->factory)($this->sm, ''); $this->assertInstanceOf(ArrayCache::class, $instance); } }