/** * @expectedException \Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException */ public function testFileWhichDoesNotExist() { $controller = new TestController(); /* @var BinaryFileResponse $response */ $response = $controller->file('some-file.txt', 'test.php'); }