/**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  * @covers Kunstmaan\MediaBundle\Helper\FolderManager::__construct
  */
 protected function setUp()
 {
     $this->repository = $this->getMockBuilder('Kunstmaan\\MediaBundle\\Repository\\FolderRepository')->disableOriginalConstructor()->getMock();
     $this->repository->expects($this->any())->method('getParentIds')->will($this->returnValue(array(1, 2)));
     $folder1 = new Folder();
     $folder1->setId(1);
     $folder2 = new Folder();
     $folder2->setId(2);
     $this->parents = array($folder1, $folder2);
     $this->repository->expects($this->any())->method('getPath')->will($this->returnValue(array($folder1, $folder2)));
     $rootFolder = new Folder();
     $rootFolder->setId(1);
     $this->repository->expects($this->any())->method('getFolder')->with($this->equalTo(1))->will($this->returnValue($rootFolder));
     $this->folder = new Folder();
     $this->folder->setId(3);
     $this->object = new FolderManager($this->repository);
 }
 /**
  * @covers Kunstmaan\MediaBundle\Entity\Folder::hasActive
  */
 public function testHasActive()
 {
     $root = new Folder();
     $root->setId(1);
     $subFolder = new Folder();
     $subFolder->setId(2);
     $root->addChild($subFolder);
     $subFolder2 = new Folder();
     $subFolder2->setId(4);
     $root->addChild($subFolder2);
     $subSubFolder = new Folder();
     $subSubFolder->setId(3);
     $subFolder->addChild($subSubFolder);
     $this->assertTrue($root->hasActive(2));
     $this->assertTrue($root->hasActive(4));
     $this->assertTrue($subFolder->hasActive(3));
     $this->assertFalse($subFolder->hasActive(4));
 }
 /**
  * @covers Kunstmaan\MediaBundle\Entity\Media::getFolder
  * @covers Kunstmaan\MediaBundle\Entity\Media::setFolder
  */
 public function testGetSetFolder()
 {
     $folder = new Folder();
     $folder->setId(45);
     $this->object->setFolder($folder);
     $this->assertEquals(45, $this->object->getFolder()->getId());
 }