In a Laravel 5 package, I am creating a class FileSelector
which is a fixed Storage-mask in the system . Public return filterFilesOnDate ($ files, datetime $ date) {return array_filter ($ files, jobs ($ file) usage ($ date) {return archive :: last modified (file $) & Lt; $ date- & gt; getTimeStamp ();}); }
This class is a path (for some files) and a storage :: disk ()
is the manufacturer in it.
Now I am trying to write some basic unit tests for this specific class using the orchestra testbint.
The Setup-Function looks like this:
Secure $ fileSelector; Protected $ date; Public Function Setup () {Origin: Setup (); $ This- & gt; Date = new date (time); $ This- & gt; File selector = new file selector ('test / _data / backup', archive :: disk ('local')); }
The unsuccessful test is:
public function test_if_files_are_filtered_on_date () {$ files = archive :: allFiles ('test / _data / backups'); $ Filtered files = $ this- & gt; File selector- & gt; Filterfileoff ($ files, $ this- & gt; date); }
Storage :: Returns all the files ('test / _data / backup')
no files . The path is correct because it returns the required files using file-mask but it is not compatible with filterFilesOnDate ()
-method because it uses the archive. The following error occurs by using
file-mask :
league \ Oriya system \ FileNotFoundException: file / test / _data / backup / ElvisPresley. Not found on zip
Am I using incorrect storage methods in testing or have I stumbled on the border of Orchestra / Testbench?
No comments:
Post a Comment