function it_gets_association_type_choices_from_repository($entityRepository, AssociationType $associationType) { $entityRepository->findBy([])->willReturn([$associationType]); $associationType->getCode()->willReturn('foo'); $associationType->getLabel()->willReturn('Foo'); $this->getAssociationTypeChoices()->shouldReturn(['foo' => 'Foo']); }
/** * Test getter/setter for label property */ public function testGetSetLabel() { // Change value and assert new $newCode = 'code'; $expectedCode = '[' . $newCode . ']'; $this->associationType->setCode($newCode); $this->assertEquals($expectedCode, $this->associationType->getLabel()); $newLabel = 'test-label'; $this->assertEntity($this->associationType->setLocale('en_US')); $this->assertEntity($this->associationType->setLabel($newLabel)); $this->assertEquals($newLabel, $this->associationType->getLabel()); // if no translation, assert the expected code is returned $this->associationType->setLocale('fr_FR'); $this->assertEquals($expectedCode, $this->associationType->getLabel()); // if empty translation, assert the expected code is returned $this->associationType->setLabel(''); $this->assertEquals($expectedCode, $this->associationType->getLabel()); }
/** * {@inheritDoc} */ public function getLabel() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getLabel', array()); return parent::getLabel(); }