createMock(LayerRepositoryFactoryServiceInterface::class); $requestedEntity = new RequestedEntity($layerRepositoryFactoryService); $slug = 'test'; $requestedEntity->setIdentity($slug); $this->assertEquals($slug, $requestedEntity->getSlug()); $this->assertFalse($requestedEntity->hasId()); $id = 123; $requestedEntity->setIdentity($id); $this->assertEquals($id, $requestedEntity->getId()); $this->assertFalse($requestedEntity->hasSlug()); } }