private function createTagWithCode($code, $title, $tagParentCode = null, $metatag = false)
 {
     if ($tag = $this->tagRepo->findOneByCod($code)) {
         throw new \Exception("Nothing done - Tag retrieved from DB id: " . $tag->getId() . " cod: " . $tag->getCod());
     }
     $tag = new Tag();
     $tag->setCod($code);
     $tag->setMetatag($metatag);
     $tag->setDisplay(true);
     $tag->setTitle($title, 'es');
     $tag->setTitle($title, 'gl');
     $tag->setTitle($title, 'en');
     if ($tagParentCode) {
         if ($parent = $this->tagRepo->findOneByCod($tagParentCode)) {
             $tag->setParent($parent);
         } elseif ('CHANNELS' === $tagParentCode) {
             $channelTag = $this->createTagWithCode('CHANNELS', 'CHANNELS', 'ROOT', true);
             $tag->setParent($channelTag);
         } elseif ('ROOT' === $tagParentCode) {
             throw new \Exception("Nothing done - There is no tag in the database with code " . $tagParentCode . " to be the parent tag. Please init Pumukit tags");
         }
     }
     $this->dm->persist($tag);
     $this->dm->flush();
     return $tag;
 }
 public function testCreate()
 {
     $tag = new Tag();
     $tag->setCod("ROOT");
     $this->dm->persist($tag);
     $this->dm->flush();
     // This should pass to check the unrequired fields
     $this->assertEquals(1, count($this->repo->findAll()));
 }
 /**
  * @Route("/category/{category}", defaults={"category" = null})
  * @Template("PumukitWebTVBundle:Search:index.html.twig")
  */
 public function multimediaObjectsAction($category, $useBlockedTagAsGeneral = false, Request $request)
 {
     if (!array_key_exists($category, $this->categories)) {
         throw $this->createNotFoundException(sprintf('Category \'%s\' does not exist', $category));
     }
     $title = $this->categories[$category]['title'];
     $this->get('pumukit_web_tv.breadcrumbs')->addList($title, 'pumukit_geant_webtv_channels_multimediaobjects', array('category' => $category));
     // --- Get Tag Parent for Tag Fields ---
     $parentTag = $this->getParentTag();
     // --- END Get Tag Parent for Tag Fields ---
     // --- Get Variables ---
     $searchFound = $request->query->get('search');
     $tagsFound = $request->query->get('tags');
     $typeFound = $request->query->get('type');
     $durationFound = $request->query->get('duration');
     $startFound = $request->query->get('start');
     $endFound = $request->query->get('end');
     $yearFound = $request->query->get('year');
     $languageFound = $request->query->get('language');
     // --- END Get Variables --
     // --- Create QueryBuilder ---
     $mmobjRepo = $this->get('doctrine_mongodb')->getRepository('PumukitSchemaBundle:MultimediaObject');
     $queryBuilder = $mmobjRepo->createStandardQueryBuilder();
     $queryBuilder->field('tags.cod')->in($this->categories[$category]['map']);
     $queryBuilder = $this->searchQueryBuilder($queryBuilder, $searchFound);
     $queryBuilder = $this->typeQueryBuilder($queryBuilder, $typeFound);
     $queryBuilder = $this->durationQueryBuilder($queryBuilder, $durationFound);
     $queryBuilder = $this->dateQueryBuilder($queryBuilder, $startFound, $endFound, $yearFound);
     $queryBuilder = $this->languageQueryBuilder($queryBuilder, $languageFound);
     $queryBuilder = $this->tagsQueryBuilder($queryBuilder, $tagsFound);
     // --- END Create QueryBuilder ---
     // --- Execute QueryBuilder and get paged results ---
     $pagerfanta = $this->createPager($queryBuilder, $request->query->get('page', 1));
     // --- Query to get existing languages ---
     $searchLanguages = $this->get('doctrine_mongodb')->getRepository('PumukitSchemaBundle:MultimediaObject')->createStandardQueryBuilder()->distinct('tracks.language')->getQuery()->execute();
     // -- Init Number Cols for showing results ---
     $numberCols = 2;
     if ($this->container->hasParameter('columns_objs_search')) {
         $numberCols = $this->container->getParameter('columns_objs_search');
     }
     $tag = new Tag();
     $tag->setCod($this->categories[$category]['map'][0]);
     $tag->setTitle($title);
     /* Added search years for Geant search.*/
     // --- Query to get oldest date ---
     $firstMmobj = $this->get('doctrine_mongodb')->getRepository('PumukitSchemaBundle:MultimediaObject')->createStandardQueryBuilder()->sort('record_date', 'asc')->limit(1)->getQuery()->getSingleResult();
     $minRecordDate = $firstMmobj->getRecordDate()->format('m/d/Y');
     $maxRecordDate = date('m/d/Y');
     // --- Query to get years for the 'Year' select form. ---
     $searchYears = $this->getYears();
     // --- RETURN ---
     return array('type' => 'multimediaObject', 'objects' => $pagerfanta, 'parent_tag' => null, 'parent_tag_optional' => $parentTag, 'tags_found' => $tagsFound, 'number_cols' => $numberCols, 'languages' => $searchLanguages, 'blocked_tag' => $tag, 'search_years' => $searchYears);
 }
Esempio n. 4
0
 /**
  * @ParamConverter("tag", class="PumukitSchemaBundle:Tag", options={"id" = "parent"})
  * @Template
  */
 public function createAction(Tag $parent, Request $request)
 {
     $dm = $this->get('doctrine_mongodb')->getManager();
     $repo = $dm->getRepository('PumukitSchemaBundle:Tag');
     $tag = new Tag();
     $tag->setParent($parent);
     $translator = $this->get('translator');
     $locale = $request->getLocale();
     $form = $this->createForm(new TagType($translator, $locale), $tag);
     if (($request->isMethod('PUT') || $request->isMethod('POST')) && $form->bind($request)->isValid()) {
         try {
             $dm->persist($tag);
             $dm->flush();
         } catch (\Exception $e) {
             return new JsonResponse(array("status" => $e->getMessage()), 409);
         }
         return $this->redirect($this->generateUrl('pumukitnewadmin_tag_list'));
     }
     return array('tag' => $tag, 'form' => $form->createView());
 }
 private function initTags($list)
 {
     $globalTag = new Tag();
     $globalTag->setCod('tv');
     $this->dm->persist($globalTag);
     $tags = array();
     foreach ($list as $i => $mm) {
         $tag = new Tag();
         $tag->setCod($i);
         $this->dm->persist($tag);
         $tags[$i] = $tag;
     }
     $this->dm->flush();
     foreach ($list as $i => $mm) {
         $mm->addTag($globalTag);
         $mm->addTag($tags[$i]);
         $this->dm->persist($mm);
     }
     $this->dm->flush();
 }
 public function testGetLast()
 {
     $series1 = $this->factoryService->createSeries();
     $series2 = $this->factoryService->createSeries();
     $this->dm->persist($series1);
     $this->dm->persist($series2);
     $this->dm->flush();
     $mm11 = $this->factoryService->createMultimediaObject($series1);
     $mm12 = $this->factoryService->createMultimediaObject($series1);
     $mm21 = $this->factoryService->createMultimediaObject($series2);
     $mm22 = $this->factoryService->createMultimediaObject($series2);
     $this->dm->persist($mm11);
     $this->dm->persist($mm12);
     $this->dm->persist($mm21);
     $this->dm->persist($mm22);
     $this->dm->flush();
     $tag = new Tag();
     $tag->setCod('PUDENEW');
     $tag->setTitle('PUDENEW');
     $this->dm->persist($tag);
     $this->dm->flush();
     $this->tagService->addTagToMultimediaObject($mm11, $tag->getId());
     $this->assertEquals(array(), $this->announceService->getLast());
 }
 /**
  * Find by tag query builder
  *
  * @param Tag|EmbeddedTag $tag
  * @return QueryBuilder
  */
 public function findByTagCodQueryBuilder($tag)
 {
     return $this->createStandardQueryBuilder()->field('tags.cod')->equals($tag->getCod());
 }
Esempio n. 8
0
 /**
  * Returns true if given node is descendant of tag
  *
  * @param EmbeddedTag|Tag $tag
  *
  * @return bool
  */
 public function isDescendantOf($tag)
 {
     if ($tag->getCod() == $this->getCod()) {
         return false;
     }
     return substr($this->getPath(), 0, strlen($tag->getPath())) === $tag->getPath();
 }
 /**
  *
  */
 private function createTagFromCsvArray($csv_array, $tag_parent = null)
 {
     if ($tag = $this->tagsRepo->findOneByCod($csv_array[1])) {
         throw new \LengthException("Nothing done - Tag retrieved from DB id: " . $tag->getId() . " cod: " . $tag->getCod());
     }
     $tag = new Tag();
     $tag->setCod($csv_array[1]);
     $tag->setMetatag($csv_array[3]);
     $tag->setDisplay($csv_array[4]);
     if ($tag_parent) {
         $tag->setParent($tag_parent);
     }
     $tag->setTitle($csv_array[5], 'es');
     // NOTE Take care of csv language order!
     if (isset($csv_array[6])) {
         $tag->setTitle($csv_array[6], 'gl');
     }
     if (isset($csv_array[7])) {
         $tag->setTitle($csv_array[7], 'en');
     }
     $this->dm->persist($tag);
     return $tag;
 }
 public function testFindWithTagAndSeriesType()
 {
     $seriesType1 = new SeriesType();
     $seriesType1->setName("Series Type 1");
     $seriesType2 = new SeriesType();
     $seriesType2->setName("Series Type 2");
     $this->dm->persist($seriesType1);
     $this->dm->persist($seriesType2);
     $tag1 = new Tag();
     $tag1->setCod('tag1');
     $tag2 = new Tag();
     $tag2->setCod('tag2');
     $tag3 = new Tag();
     $tag3->setCod('tag3');
     $this->dm->persist($tag1);
     $this->dm->persist($tag2);
     $this->dm->persist($tag3);
     $this->dm->flush();
     $broadcast = $this->createBroadcast(Broadcast::BROADCAST_TYPE_PRI);
     $series1 = $this->createSeries('Series 1');
     $series1->setSeriesType($seriesType1);
     $mm11 = $this->factoryService->createMultimediaObject($series1);
     $mm12 = $this->factoryService->createMultimediaObject($series1);
     $mm13 = $this->factoryService->createMultimediaObject($series1);
     $series2 = $this->createSeries('Series 2');
     $series2->setSeriesType($seriesType1);
     $mm21 = $this->factoryService->createMultimediaObject($series2);
     $mm22 = $this->factoryService->createMultimediaObject($series2);
     $mm23 = $this->factoryService->createMultimediaObject($series2);
     $series3 = $this->createSeries('Series 3');
     $series3->setSeriesType($seriesType2);
     $mm31 = $this->factoryService->createMultimediaObject($series3);
     $mm32 = $this->factoryService->createMultimediaObject($series3);
     $mm33 = $this->factoryService->createMultimediaObject($series3);
     $mm34 = $this->factoryService->createMultimediaObject($series3);
     $mm11->addTag($tag1);
     $mm11->addTag($tag2);
     $mm12->addTag($tag1);
     $mm12->addTag($tag2);
     $mm13->addTag($tag1);
     $mm13->addTag($tag2);
     $mm21->addTag($tag2);
     $mm22->addTag($tag1);
     $mm22->addTag($tag2);
     $mm23->addTag($tag1);
     $mm31->addTag($tag1);
     $mm32->addTag($tag2);
     $mm32->addTag($tag3);
     $mm33->addTag($tag1);
     $mm34->addTag($tag1);
     $this->dm->persist($mm11);
     $this->dm->persist($mm12);
     $this->dm->persist($mm13);
     $this->dm->persist($mm21);
     $this->dm->persist($mm22);
     $this->dm->persist($mm23);
     $this->dm->persist($mm31);
     $this->dm->persist($mm32);
     $this->dm->persist($mm33);
     $this->dm->persist($mm34);
     $this->dm->persist($series1);
     $this->dm->persist($series2);
     $this->dm->persist($series3);
     $this->dm->flush();
     $this->assertEquals(2, count($this->repo->findWithTagAndSeriesType($tag1, $seriesType1)));
     $this->assertEquals(2, count($this->repo->findWithTagAndSeriesType($tag2, $seriesType1)));
     $this->assertEquals(0, count($this->repo->findWithTagAndSeriesType($tag3, $seriesType1)));
     $this->assertEquals(1, count($this->repo->findWithTagAndSeriesType($tag1, $seriesType2)));
     $this->assertEquals(1, count($this->repo->findWithTagAndSeriesType($tag2, $seriesType2)));
     $this->assertEquals(1, count($this->repo->findWithTagAndSeriesType($tag3, $seriesType2)));
 }
 /**
  * Contains tag
  *
  * The original string tag logic used in_array to check it.
  * This function uses doctrine2 arrayCollection contains function instead.
  *
  * @param  Tag|EmbeddedTag $tagToCheck
  * @return boolean         TRUE if this multimedia_object contained the specified tag, FALSE otherwise.
  */
 public function containsTag($tagToCheck)
 {
     foreach ($this->tags as $tag) {
         if ($tag->getCod() == $tagToCheck->getCod()) {
             return true;
         }
     }
     return false;
 }
 private function createTestTree()
 {
     $tag = new Tag();
     $tag->setCod("ROOT");
     $this->dm->persist($tag);
     $this->dm->flush();
     $tagA = new Tag();
     $tagA->setCod("A");
     $tagA->setParent($tag);
     $this->dm->persist($tagA);
     $tagB = new Tag();
     $tagB->setCod("B");
     $tagB->setParent($tag);
     $this->dm->persist($tagB);
     $tagB1 = new Tag();
     $tagB1->setCod("B1");
     $tagB1->setParent($tagB);
     $this->dm->persist($tagB1);
     $tagB2 = new Tag();
     $tagB2->setCod("B2");
     $tagB2->setParent($tagB);
     $this->dm->persist($tagB2);
     $tagB2A = new Tag();
     $tagB2A->setCod("B2A");
     $tagB2A->setParent($tagB2);
     $this->dm->persist($tagB2A);
     $this->dm->flush();
 }
 /**
  * 
  */
 public function getChildrenTagAction(Tag $tag, Request $request)
 {
     $config = $this->getConfiguration();
     $view = $this->view()->setTemplate($config->getTemplate('listtagsajax.html'))->setData(array('nodes' => $tag->getChildren(), 'parent' => $tag->getId(), 'mmId' => $request->get('mm_id'), 'block_tag' => $request->get('tag_id')));
     return $this->handleView($view);
 }
 public function testFindByTagCod()
 {
     $tag = new Tag();
     $tag->setCod('tag');
     $this->dm->persist($tag);
     $this->dm->flush();
     $series = $this->createSeries('Series');
     $multimediaObject = $this->factoryService->createMultimediaObject($series);
     $sort = array('public_date' => -1);
     $this->assertCount(0, $this->repo->findByTagCod($tag, $sort));
     $addedTags = $this->tagService->addTagToMultimediaObject($multimediaObject, $tag->getId());
     $multimediaObjects = $this->repo->findByTagCod($tag, $sort)->toArray();
     $this->assertCount(1, $multimediaObjects);
     $this->assertTrue(in_array($multimediaObject, $multimediaObjects));
 }
Esempio n. 15
0
 public function testNumberMultimediaObjects()
 {
     $tag = new Tag();
     $this->assertEquals(0, $tag->getNumberMultimediaObjects());
     $tag->increaseNumberMultimediaObjects();
     $this->assertEquals(1, $tag->getNumberMultimediaObjects());
     $tag->increaseNumberMultimediaObjects();
     $this->assertEquals(2, $tag->getNumberMultimediaObjects());
     $tag->decreaseNumberMultimediaObjects();
     $this->assertEquals(1, $tag->getNumberMultimediaObjects());
     $tag->decreaseNumberMultimediaObjects();
     $this->assertEquals(0, $tag->getNumberMultimediaObjects());
     $count = 5;
     $tag->setNumberMultimediaObjects($count);
     $this->assertEquals(5, $tag->getNumberMultimediaObjects());
 }
Esempio n. 16
0
 private function createTagWithTree($cod, $withROOT = true)
 {
     if ($withROOT) {
         $rootTag = $this->tagRepo->findOneByCod('ROOT');
         if (null == $rootTag) {
             $rootTag = new Tag();
             $rootTag->setCod('ROOT');
             $this->dm->persist($rootTag);
         }
     } else {
         $rootTag = $this->tagRepo->findOneByCod('grandparent');
         if (null == $rootTag) {
             $rootTag = new Tag();
             $rootTag->setCod('grandparent');
             $this->dm->persist($rootTag);
         }
     }
     $locale = 'en';
     $parentTag = $this->tagRepo->findOneByCod('parent');
     if (null == $parentTag) {
         $parentTag = new Tag();
         $parentTag->setLocale($locale);
         $parentTag->setCod('parent');
         $parentTag->setTitle('Parent');
         $parentTag->setParent($rootTag);
         $this->dm->persist($parentTag);
     }
     $tag = new Tag();
     $tag->setLocale($locale);
     $tag->setCod($cod);
     $tag->setTitle(ucfirst($cod));
     $tag->setParent($parentTag);
     $this->dm->persist($tag);
     $broTag = $this->tagRepo->findOneByCod('brother');
     if (null == $broTag) {
         $broTag = new Tag();
         $broTag->setLocale($locale);
         $broTag->setCod('brother');
         $broTag->setTitle('Brother');
         $broTag->setParent($parentTag);
         $this->dm->persist($broTag);
     }
     $this->dm->flush();
     return $tag;
 }
 public function syncMmobj($parsedTerena, \MongoDate $lastSyncDate = null)
 {
     if (!isset($lastSyncDate)) {
         $lastSyncDate = new \MongoDate();
     }
     $factory = $this->factoryService;
     $mmobj = $this->mmobjRepo->createQueryBuilder()->field('properties.geant_id')->equals($parsedTerena['identifier'])->getQuery()->getSingleResult();
     $series = $this->seriesRepo->createQueryBuilder()->field('properties.geant_provider')->equals($parsedTerena['provider'])->getQuery()->getSingleResult();
     if (!isset($series)) {
         $series = $factory->createSeries();
         $series->setProperty('geant_provider', $parsedTerena['provider']);
         $series->setTitle($parsedTerena['provider']);
         $this->dm->persist($series);
         $this->dm->flush();
     }
     //We assume the 'provider' property of a feed won't change for the same Geant Feed Resource.
     //If it changes, the mmobj would keep it's original provider.
     if (!isset($mmobj)) {
         $mmobj = $factory->createMultimediaObject($series, false);
         $mmobj->setProperty('geant_id', $parsedTerena['identifier']);
         //Add 'provider' tag
         $providerTag = $this->tagRepo->findOneByCod($parsedTerena['provider']);
         if (!isset($providerTag)) {
             $providerTag = new Tag();
             $providerTag->setParent($this->providerRootTag);
             $providerTag->setCod($parsedTerena['provider']);
             $providerTag->setTitle($parsedTerena['provider']);
             $providerTag->setDisplay(true);
             $providerTag->setMetatag(false);
             $this->dm->persist($providerTag);
         }
         $this->tagService->addTagToMultimediaObject($mmobj, $providerTag->getId(), false);
     } else {
         $feedUpdatedDate = $mmobj->getProperty('feed_updated_date');
         //We will disable this 'improvement' for now. We can consider to add it with an optional parameter on the future.
         /*if (!$feedUpdatedDate || $feedUpdatedDate < $parsedTerena['lastUpdateDate']) {
                         $mmobj->setProperty('feed_updated_date', new \MongoDate($parsedTerena['lastUpdateDate']->getTimestamp()));
                     } else {
                         $mmobj->setProperty('last_sync_date', $lastSyncDate);
                         $series->setProperty('last_sync_date', $lastSyncDate);
                         $mmobj->setStatus(MultimediaObject::STATUS_PUBLISHED);
                         $this->dm->persist($mmobj);
         
                         return 0;
                     }*/
     }
     $mmobj->setProperty('last_sync_date', $lastSyncDate);
     $series->setProperty('last_sync_date', $lastSyncDate);
     //PUBLISH
     $mmobj->setStatus(MultimediaObject::STATUS_PUBLISHED);
     $this->tagService->addTagToMultimediaObject($mmobj, $this->webTVTag->getId(), false);
     //METADATA
     $this->syncMetadata($mmobj, $parsedTerena);
     //TAGS
     $this->syncTags($mmobj, $parsedTerena);
     //PEOPLE
     $this->syncPeople($mmobj, $parsedTerena);
     //TRACK
     $this->syncTrack($mmobj, $parsedTerena);
     //THUMBNAIL
     $this->syncThumbnail($mmobj, $parsedTerena);
     //Errors
     if ($parsedTerena['geantErrors']) {
         $mmobj->setProperty('geant_errors', $parsedTerena['geantErrors']);
     } else {
         $mmobj->setProperty('geant_errors', null);
     }
     //SAVE CHANGES
     $this->dm->persist($mmobj);
     $this->dm->persist($series);
 }
 public function testClone()
 {
     $this->createBroadcasts();
     $series = $this->factory->createSeries();
     $src = $this->factory->createMultimediaObject($series);
     $tagA = new Tag();
     $tagA->setCod("A");
     $this->dm->persist($tagA);
     $this->dm->flush();
     $tagB = new Tag();
     $tagB->setCod("B");
     $this->dm->persist($tagB);
     $this->dm->flush();
     $personA = new Person();
     $personB = new Person();
     $roleA = new Role();
     $roleB = new Role();
     $src->addTag($tagA);
     $src->addTag($tagB);
     $src->addPersonWithRole($personA, $roleA);
     $src->addPersonWithRole($personB, $roleB);
     $new = $this->factory->cloneMultimediaObject($src);
     $this->assertEquals($new->getI18nTitle(), $src->getI18nTitle());
     $this->assertEquals($new->getI18nSubtitle(), $src->getI18nSubtitle());
     $this->assertEquals($new->getI18nDescription(), $src->getI18nDescription());
     $this->assertEquals($new->getI18nLine2(), $src->getI18nLine2());
     $this->assertEquals($new->getI18nKeyword(), $src->getI18nKeyword());
     $this->assertEquals($new->getCopyright(), $src->getCopyright());
     $this->assertEquals($new->getLicense(), $src->getLicense());
     $this->assertEquals($new->getPublicDate(), $src->getPublicDate());
     $this->assertEquals($new->getRecordDate(), $src->getRecordDate());
     $this->assertEquals($new->getStatus(), MultimediaObject::STATUS_BLOQ);
     $this->assertEquals($new->getBroadcast(), $src->getBroadcast());
     $this->assertEquals(count($new->getRoles()), count($src->getRoles()));
     $this->assertEquals(count($new->getTags()), count($src->getTags()));
 }
 public function testTagCollection()
 {
     $mm = new MultimediaObject();
     $tag0 = new Tag();
     $tag0->setCod('cod0');
     $tag1 = new Tag();
     $tag1->setCod('cod1');
     $tag2 = new Tag();
     $tag2->setCod('cod2');
     $tag3 = new Tag();
     $tag3->setCod('cod3');
     $tag4 = new Tag();
     $tag4->setCod('cod4');
     $this->assertFalse($mm->containsTag($tag1));
     $mm->addTag($tag1);
     $this->assertTrue($mm->containsTag($tag1));
     $mm->removeTag($tag1);
     $this->assertFalse($mm->containsTag($tag1));
     $this->assertFalse($mm->containsTagWithCod($tag1->getCod()));
     $mm->addTag($tag1);
     $this->assertTrue($mm->containsTagWithCod($tag1->getCod()));
     $mm->removeTag($tag1);
     $this->assertFalse($mm->containsTagWithCod($tag1->getCod()));
     //Repeat Tag
     $this->assertFalse($mm->containsTag($tag1));
     $mm->addTag($tag1);
     $mm->addTag($tag1);
     $this->assertTrue($mm->containsTag($tag1));
     $mm->removeTag($tag1);
     $this->assertFalse($mm->containsTag($tag1));
     $this->assertFalse($mm->removeTag($tag1));
     //containsAllTag and containsAnyTag
     $mm->addTag($tag1);
     $mm->addTag($tag2);
     $mm->addTag($tag3);
     $this->assertTrue($mm->containsAnyTag(array($tag0, $tag2)));
     $this->assertTrue($mm->containsAnyTag(array($tag2, $tag3)));
     $this->assertFalse($mm->containsAnyTag(array($tag0, $tag4)));
     $this->assertTrue($mm->containsAllTags(array($tag1, $tag2)));
     $this->assertTrue($mm->containsAllTags(array($tag1)));
     $this->assertFalse($mm->containsAllTags(array($tag0, $tag2)));
     $this->assertFalse($mm->containsAllTags(array($tag0, $tag1, $tag2, $tag3)));
     //containsAllTagsWithCodes and containsAnyTagWithCodes
     $mm->removeTag($tag1);
     $mm->removeTag($tag2);
     $mm->removeTag($tag3);
     $mm->addTag($tag1);
     $mm->addTag($tag4);
     $this->assertTrue($mm->containsAllTagsWithCodes(array($tag1->getCod(), $tag4->getCod())));
     $mm->removeTag($tag4);
     $this->assertFalse($mm->containsAllTagsWithCodes(array($tag4->getCod())));
     $this->assertTrue($mm->containsAllTagsWithCodes(array($tag1->getCod())));
     $this->assertFalse($mm->containsAnyTagWithCodes(array($tag4->getCod())));
     $this->assertTrue($mm->containsAnyTagWithCodes(array($tag1->getCod())));
 }