public function testItAddsTypeThatIsNotYetInStorage() { $this->generator->shouldReceive('getTypeClassName')->with(FooBar::class)->andReturn('__Enum__\\' . FooBarType::class); $this->storage->shouldReceive('exists')->with('__Enum__\\' . FooBarType::class)->andReturn(false); $this->generator->shouldNotReceive('generate')->with('foobar', FooBar::class)->andReturn(new GenerationResult('__Enum__\\' . FooBarType::class, 'type_class_content')); $this->storage->shouldReceive('save')->with('__Enum__\\' . FooBarType::class, 'type_class_content'); $this->assertFalse(Type::hasType('foobar')); $this->sut->addType('foobar', FooBar::class); $map = Type::getTypesMap(); $this->assertEquals('__Enum__\\' . FooBarType::class, $map['foobar']); }