/** * Test for __toString method */ public function testToString() { // Change value and assert new $newCode = 'toStringCode'; $expectedCode = '[' . $newCode . ']'; $this->group->setCode($newCode); $this->assertEquals($expectedCode, $this->group->__toString()); $newLabel = 'toStringLabel'; $this->assertEntity($this->group->setLocale('en_US')); $this->assertEntity($this->group->setLabel($newLabel)); $this->assertEquals($newLabel, $this->group->__toString()); // if no translation, assert the expected code is returned $this->group->setLocale('fr_FR'); $this->assertEquals($expectedCode, $this->group->__toString()); // if empty translation, assert the expected code is returned $this->group->setLabel(''); $this->assertEquals($expectedCode, $this->group->__toString()); }
/** * {@inheritDoc} */ public function setLabel($label) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'setLabel', array($label)); return parent::setLabel($label); }