-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathFile.php
45 lines (39 loc) · 1021 Bytes
/
File.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
namespace spec\Rackem;
use PHPSpec2\ObjectBehavior;
class File extends ObjectBehavior
{
public function let()
{
$this->beConstructedWith(dirname(dirname(__DIR__)));
}
public function it_should_be_initializable()
{
$this->shouldHaveType('Rackem\File');
}
public function it_should_serve_existing_files()
{
$file = dirname(dirname(__DIR__))."/README.md";
$env = array(
"PATH_INFO" => "/README.md"
);
$data = file_get_contents($file);
$expect = array(
200,
array("Last-Modified"=>filemtime($file), "Content-Type"=>"text/plain", "Content-Length"=>filesize($file).""),
array($data)
);
$this->call($env)->shouldReturn($expect);
}
public function it_should_handle_missing_files()
{
$path = "/foo";
$length = strlen("File not found: $path\n");
$expect = array(
404,
array("Content-Type"=>"text/plain", "Content-Length"=>"$length", "X-Cascade"=>"pass"),
array("File not found: $path\n")
);
$this->call(array("PATH_INFO"=>$path))->shouldReturn($expect);
}
}