File tree 2 files changed +30
-0
lines changed
2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 7
7
use Enqueue \Psr \PsrDestination ;
8
8
use Enqueue \Psr \PsrQueue ;
9
9
use Makasim \File \TempFile ;
10
+ use Symfony \Component \Filesystem \Filesystem ;
10
11
use Symfony \Component \Filesystem \LockHandler ;
11
12
12
13
class FsContext implements PsrContext
@@ -38,6 +39,9 @@ class FsContext implements PsrContext
38
39
*/
39
40
public function __construct ($ storeDir , $ preFetchCount , $ chmod )
40
41
{
42
+ $ fs = new Filesystem ();
43
+ $ fs ->mkdir ($ storeDir );
44
+
41
45
$ this ->storeDir = $ storeDir ;
42
46
$ this ->preFetchCount = $ preFetchCount ;
43
47
$ this ->chmod = $ chmod ;
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Enqueue \Fs \Tests \Functional ;
4
+
5
+ use Enqueue \Fs \FsConnectionFactory ;
6
+ use PHPUnit \Framework \TestCase ;
7
+ use Symfony \Component \Filesystem \Filesystem ;
8
+
9
+ class FsContextTest extends TestCase
10
+ {
11
+ public function tearDown ()
12
+ {
13
+ $ fs = new Filesystem ();
14
+ $ fs ->remove (sys_get_temp_dir ().'/enqueue ' );
15
+ }
16
+
17
+ public function testShouldCreateFoldersIfNotExistOnConstruct ()
18
+ {
19
+ $ fs = new Filesystem ();
20
+ $ fs ->remove (sys_get_temp_dir ().'/enqueue ' );
21
+
22
+ $ this ->fsContext = (new FsConnectionFactory (['store_dir ' => sys_get_temp_dir ().'/enqueue/dir/notexiststest ' ]))->createContext ();
23
+
24
+ $ this ->assertDirectoryExists (sys_get_temp_dir ().'/enqueue/dir/notexiststest ' );
25
+ }
26
+ }
You can’t perform that action at this time.
0 commit comments