/**
  * Test related method
  */
 public function testLocaleActivation()
 {
     $locale1 = $this->createLocale('en_US');
     $locale2 = $this->createLocale('fr_FR');
     $this->channel->addLocale($locale1);
     $this->channel->addLocale($locale2);
     $this->assertTrue($locale1->isActivated());
     $this->assertTrue($locale2->isActivated());
     $this->channel->removeLocale($locale1);
     $this->channel->removeLocale($locale2);
     $this->assertFalse($locale1->isActivated());
     $this->assertFalse($locale2->isActivated());
 }
 /**
  * {@inheritDoc}
  */
 public function removeLocale(\Pim\Bundle\CatalogBundle\Model\LocaleInterface $locale)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'removeLocale', array($locale));
     return parent::removeLocale($locale);
 }
 /**
  * Remove channel
  *
  * @param Request $request
  * @param Channel $channel
  *
  * @AclAncestor("pim_enrich_channel_remove")
  * @return Response
  */
 public function removeAction(Request $request, Channel $channel)
 {
     $channelCount = $this->getRepository('PimCatalogBundle:Channel')->countAll();
     if ($channelCount <= 1) {
         throw new DeleteException($this->getTranslator()->trans('flash.channel.not removable'));
     }
     foreach ($channel->getLocales() as $locale) {
         $channel->removeLocale($locale);
         $this->persist($locale, false);
     }
     $this->remove($channel);
     if ($request->isXmlHttpRequest()) {
         return new Response('', 204);
     } else {
         return $this->redirect($this->generateUrl('pim_enrich_channel_index'));
     }
 }