@@ -41,6 +41,7 @@ public function can_create_for_spl_file(): void
41
41
$ file = TempFile::for (new \SplFileInfo (__FILE__ ));
42
42
43
43
$ this ->assertSame (\file_get_contents (__FILE__ ), $ file ->contents ());
44
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
44
45
}
45
46
46
47
/**
@@ -53,14 +54,16 @@ public function can_create_with_extension(): void
53
54
$ this ->assertFileExists ($ file );
54
55
$ this ->assertStringEndsWith ('.gif ' , (string ) $ file );
55
56
$ this ->assertFileDoesNotExist (\mb_substr ($ file , 0 , -4 ));
57
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
56
58
}
57
59
58
60
/**
59
61
* @test
60
62
*/
61
63
public function exists_when_created (): void
62
64
{
63
- $ this ->assertFileExists (new TempFile ());
65
+ $ this ->assertFileExists ($ file = new TempFile ());
66
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
64
67
}
65
68
66
69
/**
@@ -103,6 +106,7 @@ public function can_create_for_stream(): void
103
106
104
107
$ this ->assertFileExists ($ file );
105
108
$ this ->assertStringEqualsFile ($ file , 'file contents ' );
109
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
106
110
}
107
111
108
112
/**
@@ -114,6 +118,7 @@ public function can_create_for_string(): void
114
118
115
119
$ this ->assertFileExists ($ file );
116
120
$ this ->assertStringEqualsFile ($ file , 'file contents ' );
121
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
117
122
}
118
123
119
124
/**
@@ -159,6 +164,7 @@ public function default_create_image_is_jpg(): void
159
164
$ this ->assertSame (10 , $ imageSize [1 ]);
160
165
$ this ->assertSame ('image/jpeg ' , $ imageSize ['mime ' ]);
161
166
$ this ->assertSame ('jpg ' , $ file ->getExtension ());
167
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
162
168
}
163
169
164
170
/**
@@ -173,6 +179,7 @@ public function can_create_image_for_type(string $type, string $expectedMime): v
173
179
$ this ->assertSame (10 , $ imageSize [1 ]);
174
180
$ this ->assertSame ($ expectedMime , $ imageSize ['mime ' ]);
175
181
$ this ->assertSame ($ type , $ file ->getExtension ());
182
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
176
183
}
177
184
178
185
public static function imageTypeProvider (): iterable
@@ -196,6 +203,7 @@ public function can_create_image_with_dimensions(): void
196
203
$ this ->assertSame (6 , $ imageSize [1 ]);
197
204
$ this ->assertSame ('image/png ' , $ imageSize ['mime ' ]);
198
205
$ this ->assertSame ('png ' , $ file ->getExtension ());
206
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
199
207
}
200
208
201
209
/**
@@ -211,6 +219,7 @@ public function can_create_image_with_name(): void
211
219
$ this ->assertSame (6 , $ imageSize [1 ]);
212
220
$ this ->assertSame ('image/png ' , $ imageSize ['mime ' ]);
213
221
$ this ->assertSame ('png ' , $ file ->getExtension ());
222
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
214
223
}
215
224
216
225
/**
@@ -253,6 +262,7 @@ public function can_create_named_temp_file(): void
253
262
$ this ->assertFileExists ($ file );
254
263
$ this ->assertSame (\sys_get_temp_dir ().'/some-file.txt ' , (string ) $ file );
255
264
$ this ->assertSame ('' , \file_get_contents ($ file ));
265
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
256
266
257
267
TempFile::purge ();
258
268
@@ -269,6 +279,7 @@ public function can_create_named_temp_file_with_string_content(): void
269
279
$ this ->assertFileExists ($ file );
270
280
$ this ->assertSame (\sys_get_temp_dir ().'/some-file.txt ' , (string ) $ file );
271
281
$ this ->assertSame ('content ' , \file_get_contents ($ file ));
282
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
272
283
273
284
TempFile::purge ();
274
285
@@ -285,6 +296,7 @@ public function can_create_named_temp_file_with_spl_file(): void
285
296
$ this ->assertFileExists ($ file );
286
297
$ this ->assertSame (\sys_get_temp_dir ().'/some-file.txt ' , (string ) $ file );
287
298
$ this ->assertFileEquals ($ file , __FILE__ );
299
+ $ this ->assertSame ('0664 ' , \mb_substr (\sprintf ('%o ' , \fileperms ($ file )), -4 ));
288
300
289
301
TempFile::purge ();
290
302
0 commit comments