public function testRepository()
 {
     $seriesType = new SeriesType();
     $name = "Series Type 1";
     $description = "Series Type description";
     $cod = "Cod_1";
     $seriesType->setName($name);
     $seriesType->setDescription($description);
     $seriesType->setCod($cod);
     $this->dm->persist($seriesType);
     $this->dm->flush();
     $this->assertEquals(1, count($this->repo->findAll()));
     $this->assertEquals($seriesType, $this->repo->find($seriesType->getId()));
 }
 private function createSeriesType($name)
 {
     $description = 'description';
     $series_type = new SeriesType();
     $series_type->setName($name);
     $series_type->setDescription($description);
     $this->dm->persist($series_type);
     $this->dm->flush();
     return $series_type;
 }
 public function testToString()
 {
     $series_type = new SeriesType();
     $this->assertEquals($series_type->getName(), $series_type->__toString());
 }
 public function testSeriesType()
 {
     $this->createBroadcasts();
     $series_type1 = new SeriesType();
     $name_type1 = 'Series type 1';
     $series_type1->setName($name_type1);
     $series_type2 = new SeriesType();
     $name_type2 = 'Series type 2';
     $series_type2->setName($name_type2);
     $this->dm->persist($series_type1);
     $this->dm->persist($series_type2);
     $this->dm->flush();
     // TODO this souldn't be in a test. This should be executed when creating the SeriesType
     //Workaround to fix reference method initialization.
     $this->dm->clear(get_class($series_type1));
     $series_type1 = $this->dm->find('PumukitSchemaBundle:SeriesType', $series_type1->getId());
     $series_type2 = $this->dm->find('PumukitSchemaBundle:SeriesType', $series_type2->getId());
     $series1 = $this->factory->createSeries();
     $name1 = "Series 1";
     $series1->setTitle($name1);
     $series2 = $this->factory->createSeries();
     $name2 = "Series 2";
     $series2->setTitle($name2);
     $series3 = $this->factory->createSeries();
     $name3 = "Series 3";
     $series3->setTitle($name3);
     $this->dm->persist($series1);
     $this->dm->persist($series2);
     $this->dm->persist($series3);
     $this->dm->flush();
     $series1->setSeriesType($series_type1);
     $series2->setSeriesType($series_type1);
     $series3->setSeriesType($series_type2);
     $this->dm->persist($series1);
     $this->dm->persist($series2);
     $this->dm->persist($series3);
     $this->dm->flush();
     $this->assertEquals(2, count($series_type1->getSeries()));
     $this->assertEquals(1, count($series_type2->getSeries()));
 }