@@ -16,7 +16,7 @@ class FileLockSpec extends ObjectBehavior
1616 public function let ()
1717 {
1818 $ this ->fs = new FileSystem ;
19- $ this ->lock_file = $ this ->fs ->path (' /path/to/lock_file.lock ' );
19+ $ this ->lock_file = $ this ->fs ->path (" /path/to/lock_file.lock " );
2020
2121 mkdir (dirname ($ this ->lock_file ), 0777 , true );
2222
@@ -34,11 +34,11 @@ public function it_should_acquire_an_exclusive_lock()
3434 $ this ->acquire ();
3535
3636 if (!file_exists ($ this ->lock_file )) {
37- throw new \Exception (' Lock file was not created ' );
37+ throw new \Exception (" Lock file was not created " );
3838 }
3939
40- if (flock (fopen ($ this ->lock_file , ' r ' ), LOCK_SH |LOCK_NB )) {
41- throw new \Exception (' Lock file was not exclusively locked ' );
40+ if (flock (fopen ($ this ->lock_file , " r " ), LOCK_SH |LOCK_NB )) {
41+ throw new \Exception (" Lock file was not exclusively locked " );
4242 }
4343 }
4444
@@ -49,15 +49,15 @@ public function it_should_acquire_a_shared_lock()
4949 $ this ->acquire ();
5050
5151 if (!file_exists ($ this ->lock_file )) {
52- throw new \Exception (' Lock file was not created ' );
52+ throw new \Exception (" Lock file was not created " );
5353 }
5454
55- if (flock (fopen ($ this ->lock_file , ' r ' ), LOCK_EX |LOCK_NB )) {
56- throw new \Exception (' Lock file was not locked againt exclusive lock ' );
55+ if (flock (fopen ($ this ->lock_file , " r " ), LOCK_EX |LOCK_NB )) {
56+ throw new \Exception (" Lock file was not locked againt exclusive lock " );
5757 }
5858
59- if (!flock (fopen ($ this ->lock_file , ' r ' ), LOCK_SH |LOCK_NB )) {
60- throw new \Exception (' Lock file was not shared locked ' );
59+ if (!flock (fopen ($ this ->lock_file , " r " ), LOCK_SH |LOCK_NB )) {
60+ throw new \Exception (" Lock file was not shared locked " );
6161 }
6262 }
6363
@@ -66,15 +66,15 @@ public function it_should_release_a_lock()
6666 $ this ->acquire ();
6767 $ this ->release ();
6868
69- if (!flock (fopen ($ this ->lock_file , ' r ' ), LOCK_EX |LOCK_NB )) {
70- throw new \Exception (' Lock file was not released ' );
69+ if (!flock (fopen ($ this ->lock_file , " r " ), LOCK_EX |LOCK_NB )) {
70+ throw new \Exception (" Lock file was not released " );
7171 }
7272 }
7373
7474 public function it_should_throw_if_it_cannot_lock ()
7575 {
7676 touch ($ this ->lock_file );
77- flock (fopen ($ this ->lock_file , ' r ' ), LOCK_SH |LOCK_NB );
77+ flock (fopen ($ this ->lock_file , " r " ), LOCK_SH |LOCK_NB );
7878
7979 $ this ->shouldThrow ()->duringAcquire ();
8080 }
@@ -87,7 +87,7 @@ public function it_remove_its_lock_file_if_not_locked()
8787 $ this ->release ();
8888
8989 if (file_exists ($ this ->lock_file )) {
90- throw new \Exception (' Lock file was not removed ' );
90+ throw new \Exception (" Lock file was not removed " );
9191 }
9292 }
9393
@@ -96,13 +96,13 @@ public function it_does_not_remove_its_lock_file_if_still_locked()
9696 $ this ->beConstructedWith ($ this ->lock_file , FileLock::SHARED , FileLock::NON_BLOCKING , true );
9797
9898 touch ($ this ->lock_file );
99- flock (fopen ($ this ->lock_file , ' r ' ), LOCK_SH |LOCK_NB );
99+ flock (fopen ($ this ->lock_file , " r " ), LOCK_SH |LOCK_NB );
100100
101101 $ this ->acquire ();
102102 $ this ->release ();
103103
104104 if (!file_exists ($ this ->lock_file )) {
105- throw new \Exception (' Lock file was removed ' );
105+ throw new \Exception (" Lock file was removed " );
106106 }
107107 }
108108
@@ -115,11 +115,11 @@ public function it_can_acquire_then_release_and_acquire_again()
115115 $ this ->acquire ();
116116
117117 if (!file_exists ($ this ->lock_file )) {
118- throw new \Exception (' Lock file was not created ' );
118+ throw new \Exception (" Lock file was not created " );
119119 }
120120
121- if (flock (fopen ($ this ->lock_file , ' r ' ), LOCK_SH |LOCK_NB )) {
122- throw new \Exception (' Lock file was not exclusively locked ' );
121+ if (flock (fopen ($ this ->lock_file , " r " ), LOCK_SH |LOCK_NB )) {
122+ throw new \Exception (" Lock file was not exclusively locked " );
123123 }
124124
125125 $ this ->release ();
0 commit comments