/** * Test that file is attached to the contribution */ public function testAttachFileTo() { $fileAttacher = new FileAttacher($this->pathGenerator); $this->assertFalse($fileAttacher->attachFileTo($this->contribution)); $this->contribution->setFileName('not_an_empty_name.jpg'); $fileAttacher->attachFileTo($this->contribution); $this->assertInstanceOf('Symfony\\Component\\HttpFoundation\\File\\File', $this->contribution->getFile()); }
/** * Test if path for an uploaded contribution file is ok */ public function testGetFileAbsolutePath() { $pathGenerator = new PathGenerator($this->directory); $fileName = 'github/woecifaun.jpg'; $this->contribution->setFileName($fileName); $absolutePath = $pathGenerator->getFileAbsolutePath($this->contribution); $this->assertEquals($absolutePath, $this->directory . DIRECTORY_SEPARATOR . $fileName); }