repository = new CacheClassDefinitionRepository( new FakeClassDefinitionRepository(), new FakeCache() ); } public function test_class_is_saved_in_cache(): void { $typeA = new ClassType(stdClass::class); $typeB = new ClassType(DateTime::class); $classA = $this->repository->for($typeA); $classB = $this->repository->for($typeA); $classC = $this->repository->for($typeB); self::assertSame($classA, $classB); self::assertNotSame($classA, $classC); } }