Page MenuHomeDevCentral

D1621.diff
No OneTemporary

D1621.diff

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

Mime Type
text/plain
Expires
Mon, Nov 18, 20:47 (19 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2251173
Default Alt Text
D1621.diff (1 KB)

Event Timeline