@@ -41,6 +41,7 @@ public function can_create_for_spl_file(): void
4141 $ file = TempFile::for (new \SplFileInfo (__FILE__ ));
4242
4343 $ this ->assertSame (\file_get_contents (__FILE__ ), $ file ->contents ());
44+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
4445 }
4546
4647 /**
@@ -53,14 +54,16 @@ public function can_create_with_extension(): void
5354 $ this ->assertFileExists ($ file );
5455 $ this ->assertStringEndsWith ('.gif ' , (string ) $ file );
5556 $ this ->assertFileDoesNotExist (\mb_substr ($ file , 0 , -4 ));
57+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
5658 }
5759
5860 /**
5961 * @test
6062 */
6163 public function exists_when_created (): void
6264 {
63- $ this ->assertFileExists (new TempFile ());
65+ $ this ->assertFileExists ($ file = new TempFile ());
66+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
6467 }
6568
6669 /**
@@ -103,6 +106,7 @@ public function can_create_for_stream(): void
103106
104107 $ this ->assertFileExists ($ file );
105108 $ this ->assertStringEqualsFile ($ file , 'file contents ' );
109+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
106110 }
107111
108112 /**
@@ -114,6 +118,7 @@ public function can_create_for_string(): void
114118
115119 $ this ->assertFileExists ($ file );
116120 $ this ->assertStringEqualsFile ($ file , 'file contents ' );
121+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
117122 }
118123
119124 /**
@@ -159,6 +164,7 @@ public function default_create_image_is_jpg(): void
159164 $ this ->assertSame (10 , $ imageSize [1 ]);
160165 $ this ->assertSame ('image/jpeg ' , $ imageSize ['mime ' ]);
161166 $ this ->assertSame ('jpg ' , $ file ->getExtension ());
167+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
162168 }
163169
164170 /**
@@ -173,6 +179,7 @@ public function can_create_image_for_type(string $type, string $expectedMime): v
173179 $ this ->assertSame (10 , $ imageSize [1 ]);
174180 $ this ->assertSame ($ expectedMime , $ imageSize ['mime ' ]);
175181 $ this ->assertSame ($ type , $ file ->getExtension ());
182+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
176183 }
177184
178185 public static function imageTypeProvider (): iterable
@@ -196,6 +203,7 @@ public function can_create_image_with_dimensions(): void
196203 $ this ->assertSame (6 , $ imageSize [1 ]);
197204 $ this ->assertSame ('image/png ' , $ imageSize ['mime ' ]);
198205 $ this ->assertSame ('png ' , $ file ->getExtension ());
206+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
199207 }
200208
201209 /**
@@ -211,6 +219,7 @@ public function can_create_image_with_name(): void
211219 $ this ->assertSame (6 , $ imageSize [1 ]);
212220 $ this ->assertSame ('image/png ' , $ imageSize ['mime ' ]);
213221 $ this ->assertSame ('png ' , $ file ->getExtension ());
222+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
214223 }
215224
216225 /**
@@ -253,6 +262,7 @@ public function can_create_named_temp_file(): void
253262 $ this ->assertFileExists ($ file );
254263 $ this ->assertSame (\sys_get_temp_dir ().'/some-file.txt ' , (string ) $ file );
255264 $ this ->assertSame ('' , \file_get_contents ($ file ));
265+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
256266
257267 TempFile::purge ();
258268
@@ -269,6 +279,7 @@ public function can_create_named_temp_file_with_string_content(): void
269279 $ this ->assertFileExists ($ file );
270280 $ this ->assertSame (\sys_get_temp_dir ().'/some-file.txt ' , (string ) $ file );
271281 $ this ->assertSame ('content ' , \file_get_contents ($ file ));
282+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
272283
273284 TempFile::purge ();
274285
@@ -285,6 +296,7 @@ public function can_create_named_temp_file_with_spl_file(): void
285296 $ this ->assertFileExists ($ file );
286297 $ this ->assertSame (\sys_get_temp_dir ().'/some-file.txt ' , (string ) $ file );
287298 $ this ->assertFileEquals ($ file , __FILE__ );
299+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
288300
289301 TempFile::purge ();
290302
0 commit comments