/**
  * @test
  */
 public function testDeleteTag()
 {
     $dummyTag1 = $this->buildDummyTag(1);
     $dummyTag2 = $this->buildDummyTag(2);
     $dummyTag3 = $this->buildDummyTag(3);
     $list = new TagCollection();
     $list->add($dummyTag1);
     $list->add($dummyTag2);
     $list->add($dummyTag3);
     $list->remove(1);
     $listFinal = [];
     foreach ($list as $item) {
         $listFinal[] = $item;
     }
     $this->assertEquals(2, count($listFinal), 'The number of objects is not equals to the real number');
     $this->assertNotContains($dummyTag2, $listFinal, 'The tag with id 2 is not deleted correctly');
 }
 /**
  * Create a Collection of Tags from a simple array data
  *
  * @param \Domain\Core\Interfaces\TagInterfaceEntity $tagEntity
  * @param array                                      $tags
  *
  * @return \Domain\Core\Tag
  */
 public static function buildTagCollectionFromArray(TagInterfaceEntity $tagEntity, $tags)
 {
     $tagCollection = null;
     if (!empty($tags)) {
         $tagCollection = new TagCollection();
         foreach ($tags as $tag) {
             $tagItem = TagFactory::buildTag($tagEntity, $tag);
             try {
                 $tagCollection->add($tagItem);
             } catch (\Exception $e) {
                 /**
                  * You can choose what to do in this case.
                  */
             }
         }
     }
     return $tagCollection;
 }