file = new UploadedFile(); } /** * @covers \Irstea\FileUploadBundle\Entity\UploadedFile::isSafePath * @dataProvider getIsSafePathvalues * * @param mixed $isSafe * @param mixed $path */ public function testIsSafePath($isSafe, $path) { static::assertEquals($isSafe, UploadedFile::isSafePath($path)); } public function getIsSafePathvalues() { return [ [true, 'toto.php'], [false, '../toto.php'], [true, 'bla/../toto.php'], [false, 'bla/.././../toto.php'], [false, '/../toto.php'], [true, '/bla/../toto.php'], [false, '../toto.php'], ]; } public function testMoveTo() { $this->file->setPath('truc/muche'); $this->file->moveTo('machin/chose/'); static::assertEquals('machin/chose/muche', $this->file->getPath()); } }