Tests/Services/DocumentServiceTest.php
changeset 67 989d9e117586
parent 65 ba6b8e38d90e
child 80 cf6a88559482
equal deleted inserted replaced
66:868d0fcdbb99 67:989d9e117586
    59         $this->assertEquals("Title 5", $doc->getTitle());
    59         $this->assertEquals("Title 5", $doc->getTitle());
    60         $this->assertEquals("Description 5", $doc->getDescription());
    60         $this->assertEquals("Description 5", $doc->getDescription());
    61         
    61         
    62         
    62         
    63     }
    63     }
       
    64     
       
    65     public function testTagOrder()
       
    66     {
       
    67         $doc = $this->getDoctrine()->getRepository("WikiTagBundle:Document")->findOneByTitle("Title 1");
       
    68         
       
    69         $this->assertNotNull($doc);
       
    70         $i = 1;
       
    71         foreach($doc->getTags() as $dt) {
       
    72             $this->assertEquals($i++, $dt->getTagOrder());
       
    73         }
       
    74         
       
    75     }
    64 
    76 
    65     public function testUpdate()
    77     public function testUpdate()
    66     {
    78     {
    67         $hostdoc = $this->getDoctrine()->getRepository("CompanyBaseBundle:Document")->findOneByTitle("Title 3");
    79         $hostdoc = $this->getDoctrine()->getRepository("CompanyBaseBundle:Document")->findOneByTitle("Title 3");
    68         
    80         
   117         $this->getDoctrine()->getEntityManager()->remove($hostdoc);
   129         $this->getDoctrine()->getEntityManager()->remove($hostdoc);
   118         $this->getDoctrine()->getEntityManager()->flush();
   130         $this->getDoctrine()->getEntityManager()->flush();
   119         
   131         
   120         $doc = $this->getDoctrine()->getRepository("WikiTagBundle:Document")->findOneByExternalId($hostdocid);
   132         $doc = $this->getDoctrine()->getRepository("WikiTagBundle:Document")->findOneByExternalId($hostdocid);
   121         
   133         
   122         //$this->assertNull($doc);
   134         $this->assertTrue(is_null($doc));
   123         
   135         
   124     }
   136     }
   125     
   137     
   126     
   138     
   127     public function testGetTagLabels()
   139     public function testGetTagLabels()
   162         $this->_application = new \Symfony\Bundle\FrameworkBundle\Console\Application($this->_kernel);
   174         $this->_application = new \Symfony\Bundle\FrameworkBundle\Console\Application($this->_kernel);
   163         $this->_application->setAutoExit(false);
   175         $this->_application->setAutoExit(false);
   164         $this->runConsole("doctrine:schema:drop", array("--force" => true));
   176         $this->runConsole("doctrine:schema:drop", array("--force" => true));
   165         $this->runConsole("wikitag:schema:create");
   177         $this->runConsole("wikitag:schema:create");
   166         $this->runConsole("cache:warmup");
   178         $this->runConsole("cache:warmup");
   167         $this->runConsole("doctrine:fixtures:load", array("--fixtures" => __DIR__ . "/../../../../../../../src/Company/BaseBundle/DataFixtures"));
   179         $this->runConsole("doctrine:fixtures:load"/*, array("--fixtures" => __DIR__ . "/../../../../../../../src/Company/BaseBundle/DataFixtures")*/);
   168     }
   180     }
   169     
   181     
   170     protected function runConsole($command, Array $options = array())
   182     protected function runConsole($command, Array $options = array())
   171     {
   183     {
   172         
   184