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