/** * Test getter/add/remove/has for locale property */ public function testGetAddRemoveHasLocale() { $this->assertCount(0, $this->channel->getLocales()); // assert adding the right entity $expectedLocaleFR = $this->createLocale('fr_FR'); $this->assertEntity($this->channel->addLocale($expectedLocaleFR)); $this->assertCount(1, $this->channel->getLocales()); $locale = $this->channel->getLocales()->first(); $this->assertEquals($expectedLocaleFR, $locale); // assert removing the right entity $expectedLocaleEN = $this->createLocale('en_US'); $this->channel->addLocale($expectedLocaleEN); $this->assertCount(2, $this->channel->getLocales()); $this->assertEntity($this->channel->removeLocale($expectedLocaleFR)); $this->assertCount(1, $this->channel->getLocales()); $locale = $this->channel->getLocales()->first(); $this->assertEquals($expectedLocaleEN, $locale); // assert add an already defined locale $this->channel->addLocale($expectedLocaleEN); $this->assertCount(1, $this->channel->getLocales()); // assert if a channel has a locale $this->assertTrue($this->channel->hasLocale($expectedLocaleEN)); $this->assertFalse($this->channel->hasLocale($expectedLocaleFR)); }
/** * {@inheritDoc} */ public function hasLocale(\Pim\Bundle\CatalogBundle\Model\LocaleInterface $locale) { $this->__initializer__ && $this->__initializer__->__invoke($this, 'hasLocale', array($locale)); return parent::hasLocale($locale); }