Skip to content

Commit e6ea522

Browse files
committed
test: Remove file_get_contents override and incorrect/invaluable tests
Overriding file_get_contents introduces different behaviour from the native function, such as the $http_response_headers missing. Removing the override revealed two test (testing a specific return path of the file_get_contents method rather then testing the behaviour or result of the subject under test) which had different behaviour between the test and runtime, therefor these tests have been removed.
1 parent b7475c0 commit e6ea522

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

tests/Uri/Retrievers/FileGetContentsTest.php

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -26,28 +26,6 @@ public function testFetchFile()
2626
$this->assertNotEmpty($result);
2727
}
2828

29-
public function testFalseReturn()
30-
{
31-
$res = new FileGetContents();
32-
33-
$this->setExpectedException(
34-
'\JsonSchema\Exception\ResourceNotFoundException',
35-
'JSON schema not found at http://example.com/false'
36-
);
37-
$res->retrieve('http://example.com/false');
38-
}
39-
40-
public function testFetchDirectory()
41-
{
42-
$res = new FileGetContents();
43-
44-
$this->setExpectedException(
45-
'\JsonSchema\Exception\ResourceNotFoundException',
46-
'JSON schema not found at file:///this/is/a/directory/'
47-
);
48-
$res->retrieve('file:///this/is/a/directory/');
49-
}
50-
5129
public function testContentType()
5230
{
5331
$res = new FileGetContents();
@@ -70,15 +48,3 @@ public function testCanHandleHttp301PermanentRedirect()
7048
}
7149
}
7250
}
73-
74-
namespace JsonSchema\Uri\Retrievers
75-
{
76-
function file_get_contents($uri)
77-
{
78-
switch ($uri) {
79-
case 'http://example.com/false': return false;
80-
case 'file:///this/is/a/directory/': return '';
81-
default: return \file_get_contents($uri);
82-
}
83-
}
84-
}

0 commit comments

Comments
 (0)