Hello,
I started to use phpspec recently in every new development I'm doing an I got an error, I don't quite understand. I'm trying to mock the class UploadedFile from the Symfony HttpFoundation component.
This is the code I have in my specifications:
class FileManagerSpec extends ObjectBehavior
{
function let(UploadedFile $file)
{
$file->willBeConstructedWith(array('path', 'originalName'));
}
function it_saves_an_uploaded_file(UploadedFile $file)
{
$this->saveFile($file);
}
}
And this is the output of the phpspec run command
FileManager
17 ! it saves an uploaded file
warning: Missing argument 2 for Symfony\Component\HttpFoundation\File\UploadedFile::__construct(), called in
/var/www/spec-uploadedfile/vendor/phpspec/prophecy/src/Prophecy/Doubler/Generator/ClassCreator.php(48) : eval()'d code
on line 6 and defined in
/var/www/spec-uploadedfile/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/File/UploadedFile.php line 92
Thank you in advance for your help!
Regards,
Alex.