-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnose
81 lines (81 loc) · 1.52 KB
/
nose
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env php
<?php
require __DIR__."/src/AssertionFailedException.class.php";
require __DIR__."/src/Nose.class.php";
$files = Nose::index(".");
if(count($files) == 0)
{
die("No files were discovered.\r\n");
}
if(@$argv[1] == "dry")
{
echo "Nose would execute these files:\r\n";
if(is_file("vendor/autoload.php"))
{
echo "vendor/autoload.php\r\n";
}
foreach($files as $file)
{
echo substr($file, 2)."\r\n";
}
exit;
}
if(is_file("vendor/autoload.php"))
{
require "vendor/autoload.php";
}
$res = Nose::test($files);
echo "\r\n".$res["tests_ran"]." test".($res["tests_ran"] == 1 ? "" : "s")." ran ";
if($res["errors"] == 0 && $res["warnings"] == 0)
{
die("flawlessly.\r\n");
}
if($res["warnings"] > 0)
{
echo "with ".$res["warnings"]." warning".($res["warnings"] == 1 ? "" : "s");
if($res["errors"] == 0)
{
if($res["successes"] == 0)
{
echo ". At least there were no errors";
}
else
{
echo " but there were no errors";
}
}
}
if($res["errors"] > 0)
{
if($res["warnings"] == 0)
{
echo "with ";
}
else
{
echo " and ";
}
echo $res["errors"]." error".($res["errors"] == 1 ? "" : "s");
}
if($res["successes"] > 0)
{
if($res["errors"] == 0)
{
echo " and ".$res["successes"]." success".($res["successes"] == 1 ? "" : "es");
}
else
{
echo ". At least there ";
if($res["warnings"] == 0)
{
echo "were no warnings and ";
}
else
{
echo ($res["successes"] == 1 ? "was " : "were ");
}
echo $res["successes"]." successful test".($res["successes"] == 1 ? "" : "s");
}
}
echo ".\r\n";
exit(1);