@@ -6,42 +6,42 @@ |
||
6 | 6 | |
7 | 7 | class Phpunit extends Controller |
8 | 8 | { |
9 | - /** |
|
10 | - * Constructs a test case with the given name. |
|
11 | - * |
|
12 | - */ |
|
13 | - public function __construct() |
|
14 | - { |
|
15 | - parent::__construct(); |
|
16 | - } |
|
17 | - |
|
18 | - /** |
|
19 | - * new method to launch a web server |
|
20 | - * @param array $options |
|
21 | - * @tutorial php bin/console server:run |
|
22 | - * php bin/console server:run -a 192.168.0.1:8000 |
|
23 | - */ |
|
24 | - public function phpunit(array $options = array()) |
|
25 | - { |
|
26 | - ob_get_clean(); |
|
27 | - |
|
28 | - $files = scandir(__DIR__.'/../../../../tests'); |
|
29 | - |
|
30 | - foreach ($files as $one) { |
|
31 | - |
|
32 | - if (is_dir(__DIR__.'/../../../../tests/'.$one) && $one != '..' && $one != '.') { |
|
33 | - |
|
34 | - $controllerFiles = scandir(__DIR__.'/../../../../tests'.'/'.$one.'/app/Controller'); |
|
35 | - |
|
36 | - foreach ($controllerFiles as $oneController) { |
|
37 | - |
|
38 | - if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController) && $oneController != '..' && $oneController != '.') { |
|
39 | - |
|
40 | - $unitTest = new \PHPUnit_TextUI_Command; |
|
41 | - $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController]); |
|
42 | - } |
|
43 | - } |
|
44 | - } |
|
45 | - } |
|
46 | - } |
|
9 | + /** |
|
10 | + * Constructs a test case with the given name. |
|
11 | + * |
|
12 | + */ |
|
13 | + public function __construct() |
|
14 | + { |
|
15 | + parent::__construct(); |
|
16 | + } |
|
17 | + |
|
18 | + /** |
|
19 | + * new method to launch a web server |
|
20 | + * @param array $options |
|
21 | + * @tutorial php bin/console server:run |
|
22 | + * php bin/console server:run -a 192.168.0.1:8000 |
|
23 | + */ |
|
24 | + public function phpunit(array $options = array()) |
|
25 | + { |
|
26 | + ob_get_clean(); |
|
27 | + |
|
28 | + $files = scandir(__DIR__.'/../../../../tests'); |
|
29 | + |
|
30 | + foreach ($files as $one) { |
|
31 | + |
|
32 | + if (is_dir(__DIR__.'/../../../../tests/'.$one) && $one != '..' && $one != '.') { |
|
33 | + |
|
34 | + $controllerFiles = scandir(__DIR__.'/../../../../tests'.'/'.$one.'/app/Controller'); |
|
35 | + |
|
36 | + foreach ($controllerFiles as $oneController) { |
|
37 | + |
|
38 | + if (is_file(__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController) && $oneController != '..' && $oneController != '.') { |
|
39 | + |
|
40 | + $unitTest = new \PHPUnit_TextUI_Command; |
|
41 | + $unitTest->run([__DIR__.'/../../../../tests/'.$one.'/app/Controller/' . $oneController]); |
|
42 | + } |
|
43 | + } |
|
44 | + } |
|
45 | + } |
|
46 | + } |
|
47 | 47 | } |
@@ -7,68 +7,68 @@ |
||
7 | 7 | |
8 | 8 | class Server extends Controller |
9 | 9 | { |
10 | - /** |
|
11 | - * new method to launch a web server |
|
12 | - * @param array $options |
|
13 | - * @tutorial php bin/console server:run |
|
14 | - * php bin/console server:run -a 192.168.0.1:8000 |
|
15 | - */ |
|
16 | - public function run(array $options = array()) |
|
17 | - { |
|
18 | - ob_get_clean(); |
|
10 | + /** |
|
11 | + * new method to launch a web server |
|
12 | + * @param array $options |
|
13 | + * @tutorial php bin/console server:run |
|
14 | + * php bin/console server:run -a 192.168.0.1:8000 |
|
15 | + */ |
|
16 | + public function run(array $options = array()) |
|
17 | + { |
|
18 | + ob_get_clean(); |
|
19 | 19 | |
20 | - if (!isset($options['a'])) { |
|
21 | - $options['a'] = 'localhost:8000'; |
|
22 | - } |
|
20 | + if (!isset($options['a'])) { |
|
21 | + $options['a'] = 'localhost:8000'; |
|
22 | + } |
|
23 | 23 | |
24 | - echo "\n\n"; |
|
25 | - echo Bash::setBackground(" ", 'green'); |
|
26 | - echo Bash::setBackground(" [OK] Start web server ", 'green'); |
|
27 | - echo Bash::setBackground(" ", 'green'); |
|
28 | - echo "\n\n"; |
|
29 | - echo " > Use ".$options['a']." in browser"; |
|
30 | - echo "\n\n"; |
|
31 | - echo " > Clic Ctrl+C to stop the web server"; |
|
32 | - echo "\n\n"; |
|
24 | + echo "\n\n"; |
|
25 | + echo Bash::setBackground(" ", 'green'); |
|
26 | + echo Bash::setBackground(" [OK] Start web server ", 'green'); |
|
27 | + echo Bash::setBackground(" ", 'green'); |
|
28 | + echo "\n\n"; |
|
29 | + echo " > Use ".$options['a']." in browser"; |
|
30 | + echo "\n\n"; |
|
31 | + echo " > Clic Ctrl+C to stop the web server"; |
|
32 | + echo "\n\n"; |
|
33 | 33 | |
34 | - exec('php -S '.$options['a'].' /public/index.php'); |
|
35 | - } |
|
34 | + exec('php -S '.$options['a'].' /public/index.php'); |
|
35 | + } |
|
36 | 36 | |
37 | - /** |
|
38 | - * check if a server web is launched |
|
39 | - * @param array $options |
|
40 | - * @tutorial php bin/console server:status |
|
41 | - * php bin/console server:status -a 192.168.0.1:8000 |
|
42 | - */ |
|
43 | - public function status(array $options = array()) |
|
44 | - { |
|
45 | - ob_get_clean(); |
|
37 | + /** |
|
38 | + * check if a server web is launched |
|
39 | + * @param array $options |
|
40 | + * @tutorial php bin/console server:status |
|
41 | + * php bin/console server:status -a 192.168.0.1:8000 |
|
42 | + */ |
|
43 | + public function status(array $options = array()) |
|
44 | + { |
|
45 | + ob_get_clean(); |
|
46 | 46 | |
47 | - if (!isset($options['a'])) { |
|
48 | - $options['a'] = 'localhost:8000'; |
|
49 | - } |
|
47 | + if (!isset($options['a'])) { |
|
48 | + $options['a'] = 'localhost:8000'; |
|
49 | + } |
|
50 | 50 | |
51 | - list($hostname, $port) = explode(':', $options['a']); |
|
51 | + list($hostname, $port) = explode(':', $options['a']); |
|
52 | 52 | |
53 | - if (false !== $fp = @fsockopen($hostname, $port, $errno, $errstr, 1)) { |
|
54 | - fclose($fp); |
|
53 | + if (false !== $fp = @fsockopen($hostname, $port, $errno, $errstr, 1)) { |
|
54 | + fclose($fp); |
|
55 | 55 | |
56 | - echo "\n\n"; |
|
57 | - echo Bash::setBackground(" ", 'green'); |
|
58 | - echo Bash::setBackground(" [OK] A web server is launched ", 'green'); |
|
59 | - echo Bash::setBackground(" ", 'green'); |
|
60 | - echo "\n\n"; |
|
61 | - echo " > Check realized on ".$options['a']; |
|
62 | - echo "\n\n"; |
|
63 | - } |
|
64 | - else { |
|
65 | - echo "\n\n"; |
|
66 | - echo Bash::setBackground(" ", 'red'); |
|
67 | - echo Bash::setBackground(" [WARNING] A web server is not used ", 'red'); |
|
68 | - echo Bash::setBackground(" ", 'red'); |
|
69 | - echo "\n\n"; |
|
70 | - echo " > Check realized on ".$options['a']; |
|
71 | - echo "\n\n"; |
|
72 | - } |
|
73 | - } |
|
56 | + echo "\n\n"; |
|
57 | + echo Bash::setBackground(" ", 'green'); |
|
58 | + echo Bash::setBackground(" [OK] A web server is launched ", 'green'); |
|
59 | + echo Bash::setBackground(" ", 'green'); |
|
60 | + echo "\n\n"; |
|
61 | + echo " > Check realized on ".$options['a']; |
|
62 | + echo "\n\n"; |
|
63 | + } |
|
64 | + else { |
|
65 | + echo "\n\n"; |
|
66 | + echo Bash::setBackground(" ", 'red'); |
|
67 | + echo Bash::setBackground(" [WARNING] A web server is not used ", 'red'); |
|
68 | + echo Bash::setBackground(" ", 'red'); |
|
69 | + echo "\n\n"; |
|
70 | + echo " > Check realized on ".$options['a']; |
|
71 | + echo "\n\n"; |
|
72 | + } |
|
73 | + } |
|
74 | 74 | } |
@@ -32,17 +32,17 @@ |
||
32 | 32 | */ |
33 | 33 | class Yaml implements ResponseInterface |
34 | 34 | { |
35 | - /** |
|
36 | - * translate the content |
|
37 | - * @see \Venus\lib\Response\ResponseInterface::translate() |
|
38 | - * |
|
39 | - * @access public |
|
40 | - * @param mixed $mContent content to translate |
|
41 | - * @return mixed |
|
42 | - */ |
|
43 | - public static function translate($mContent) |
|
44 | - { |
|
45 | - return yaml_emit($mContent); |
|
46 | - } |
|
35 | + /** |
|
36 | + * translate the content |
|
37 | + * @see \Venus\lib\Response\ResponseInterface::translate() |
|
38 | + * |
|
39 | + * @access public |
|
40 | + * @param mixed $mContent content to translate |
|
41 | + * @return mixed |
|
42 | + */ |
|
43 | + public static function translate($mContent) |
|
44 | + { |
|
45 | + return yaml_emit($mContent); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
@@ -33,17 +33,17 @@ |
||
33 | 33 | */ |
34 | 34 | class Json implements ResponseInterface |
35 | 35 | { |
36 | - /** |
|
37 | - * translate the content |
|
38 | - * @see \Venus\lib\Response\ResponseInterface::translate() |
|
39 | - * |
|
40 | - * @access public |
|
41 | - * @param mixed $mContent content to translate |
|
42 | - * @return mixed |
|
43 | - */ |
|
44 | - public static function translate($mContent) |
|
45 | - { |
|
46 | - return json_encode(ObjectOperation::objectToArray($mContent)); |
|
47 | - } |
|
36 | + /** |
|
37 | + * translate the content |
|
38 | + * @see \Venus\lib\Response\ResponseInterface::translate() |
|
39 | + * |
|
40 | + * @access public |
|
41 | + * @param mixed $mContent content to translate |
|
42 | + * @return mixed |
|
43 | + */ |
|
44 | + public static function translate($mContent) |
|
45 | + { |
|
46 | + return json_encode(ObjectOperation::objectToArray($mContent)); |
|
47 | + } |
|
48 | 48 | |
49 | 49 | } |
@@ -32,17 +32,17 @@ |
||
32 | 32 | */ |
33 | 33 | class Mock implements ResponseInterface |
34 | 34 | { |
35 | - /** |
|
36 | - * translate the content |
|
37 | - * @see \Venus\lib\Response\ResponseInterface::translate() |
|
38 | - * |
|
39 | - * @access public |
|
40 | - * @param mixed $mContent content to translate |
|
41 | - * @return mixed |
|
42 | - */ |
|
43 | - public static function translate($mContent) |
|
44 | - { |
|
45 | - return $mContent; |
|
46 | - } |
|
35 | + /** |
|
36 | + * translate the content |
|
37 | + * @see \Venus\lib\Response\ResponseInterface::translate() |
|
38 | + * |
|
39 | + * @access public |
|
40 | + * @param mixed $mContent content to translate |
|
41 | + * @return mixed |
|
42 | + */ |
|
43 | + public static function translate($mContent) |
|
44 | + { |
|
45 | + return $mContent; |
|
46 | + } |
|
47 | 47 | |
48 | 48 | } |
@@ -9,18 +9,18 @@ |
||
9 | 9 | |
10 | 10 | class Request implements RequestInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * get parameter |
|
14 | - * @param string $name |
|
15 | - * @param string $default |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - public function get(string $name, string $default = null) : string |
|
19 | - { |
|
20 | - if (isset($_POST[$name]) && $_POST[$name] != '') { |
|
21 | - return $_POST[$name]; |
|
22 | - } else if ($default !== null) { |
|
23 | - return $default; |
|
24 | - } |
|
25 | - } |
|
12 | + /** |
|
13 | + * get parameter |
|
14 | + * @param string $name |
|
15 | + * @param string $default |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + public function get(string $name, string $default = null) : string |
|
19 | + { |
|
20 | + if (isset($_POST[$name]) && $_POST[$name] != '') { |
|
21 | + return $_POST[$name]; |
|
22 | + } else if ($default !== null) { |
|
23 | + return $default; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | } |
@@ -9,18 +9,18 @@ |
||
9 | 9 | |
10 | 10 | class Query implements RequestInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * get parameter |
|
14 | - * @param string $name |
|
15 | - * @param string $default |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - public function get(string $name, string $default = null) : string |
|
19 | - { |
|
20 | - if (isset($_GET[$name]) && $_GET[$name] != '') { |
|
21 | - return $_GET[$name]; |
|
22 | - } else if ($default !== null) { |
|
23 | - return $default; |
|
24 | - } |
|
25 | - } |
|
12 | + /** |
|
13 | + * get parameter |
|
14 | + * @param string $name |
|
15 | + * @param string $default |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + public function get(string $name, string $default = null) : string |
|
19 | + { |
|
20 | + if (isset($_GET[$name]) && $_GET[$name] != '') { |
|
21 | + return $_GET[$name]; |
|
22 | + } else if ($default !== null) { |
|
23 | + return $default; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | } |
@@ -9,18 +9,18 @@ |
||
9 | 9 | |
10 | 10 | class Server implements RequestInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * get parameter |
|
14 | - * @param string $name |
|
15 | - * @param string $default |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - public function get(string $name, string $default = null) : string |
|
19 | - { |
|
20 | - if (isset($_SERVER[$name]) && $_SERVER[$name] != '') { |
|
21 | - return $_SERVER[$name]; |
|
22 | - } else if ($default !== null) { |
|
23 | - return $default; |
|
24 | - } |
|
25 | - } |
|
12 | + /** |
|
13 | + * get parameter |
|
14 | + * @param string $name |
|
15 | + * @param string $default |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + public function get(string $name, string $default = null) : string |
|
19 | + { |
|
20 | + if (isset($_SERVER[$name]) && $_SERVER[$name] != '') { |
|
21 | + return $_SERVER[$name]; |
|
22 | + } else if ($default !== null) { |
|
23 | + return $default; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | } |
@@ -9,18 +9,18 @@ |
||
9 | 9 | |
10 | 10 | class Cookies implements RequestInterface |
11 | 11 | { |
12 | - /** |
|
13 | - * get parameter |
|
14 | - * @param string $name |
|
15 | - * @param string $default |
|
16 | - * @return string |
|
17 | - */ |
|
18 | - public function get(string $name, string $default = null) : string |
|
19 | - { |
|
20 | - if (isset($_COOKIE[$name]) && $_COOKIE[$name] != '') { |
|
21 | - return $_COOKIE[$name]; |
|
22 | - } else if ($default !== null) { |
|
23 | - return $default; |
|
24 | - } |
|
25 | - } |
|
12 | + /** |
|
13 | + * get parameter |
|
14 | + * @param string $name |
|
15 | + * @param string $default |
|
16 | + * @return string |
|
17 | + */ |
|
18 | + public function get(string $name, string $default = null) : string |
|
19 | + { |
|
20 | + if (isset($_COOKIE[$name]) && $_COOKIE[$name] != '') { |
|
21 | + return $_COOKIE[$name]; |
|
22 | + } else if ($default !== null) { |
|
23 | + return $default; |
|
24 | + } |
|
25 | + } |
|
26 | 26 | } |