Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3752999
D1621.id4140.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D1621.id4140.diff
View Options
diff --git a/tests/Reflection/CodeFileTest.php b/tests/Reflection/CodeFileTest.php
--- a/tests/Reflection/CodeFileTest.php
+++ b/tests/Reflection/CodeFileTest.php
@@ -35,6 +35,14 @@
$this->assertFalse($this->notExistingCodeFile->canBeIncluded());
}
+ public function testCanBeIncludedWhenFileModeForbidsReading () : void {
+ $file = $this->getNonReadableFile();
+
+ $this->assertFalse(CodeFile::From($file)->canBeIncluded());
+
+ unlink($file);
+ }
+
public function testTryInclude () : void {
$this->assertTrue($this->validCodeFile->tryInclude());
$this->assertTrue(class_exists(Bar::class));
@@ -42,4 +50,23 @@
$this->assertFalse($this->notExistingCodeFile->tryInclude());
}
+ public function testIsReadable () : void {
+ $this->assertTrue($this->validCodeFile->isReadable());
+ }
+
+ public function testIsReadableWhenFileModeForbidsReading () : void {
+ $file = $this->getNonReadableFile();
+
+ $this->assertFalse(CodeFile::From($file)->isReadable());
+
+ unlink($file);
+ }
+
+ private function getNonReadableFile () : string {
+ $file = tempnam(sys_get_temp_dir(), "testCodeFile");
+ chmod($file, 0);
+
+ return $file;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 18, 22:31 (21 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2251173
Default Alt Text
D1621.id4140.diff (1 KB)
Attached To
Mode
D1621: Test CodeFile::isReadable and canBeIncluded with chmod 000 file
Attached
Detach File
Event Timeline
Log In to Comment