Completed
Pull Request — master (#327)
by
unknown
02:25
created
application/tests/_ci_phpunit_test/patcher/Cache.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -251,10 +251,10 @@
 block discarded – undo
251 251
 	}
252 252
 
253 253
 	/**
254
-	* Recursive Unlink
255
-	*
256
-	* @param string $dir
257
-	*/
254
+	 * Recursive Unlink
255
+	 *
256
+	 * @param string $dir
257
+	 */
258 258
 	protected static function recursiveUnlink($dir)
259 259
 	{
260 260
 		if (! is_dir($dir))
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/MonkeyPatch.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -37,12 +37,12 @@
 block discarded – undo
37 37
 	}
38 38
 
39 39
 	/**
40
-     * Patch on constant
41
-     * 
42
-     * @param type $constant
43
-     * @param type $value
44
-     * @param type $class_method
45
-     */
40
+	 * Patch on constant
41
+	 * 
42
+	 * @param type $constant
43
+	 * @param type $value
44
+	 * @param type $class_method
45
+	 */
46 46
 	public static function patchConstant($constant, $value, $class_method = null)
47 47
 	{
48 48
 		ConstProxy::patch($constant, $value, $class_method);
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/TestSuiteProvider.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -52,71 +52,71 @@
 block discarded – undo
52 52
  */
53 53
 final class TestSuiteProvider
54 54
 {
55
-    /**
56
-     * phpunit configuration file
57
-     *
58
-     * @var string
59
-     */
60
-    private static $file;
55
+	/**
56
+	 * phpunit configuration file
57
+	 *
58
+	 * @var string
59
+	 */
60
+	private static $file;
61 61
 
62
-    /**
63
-     * constructor
64
-     */
65
-    private function __construct() {}
62
+	/**
63
+	 * constructor
64
+	 */
65
+	private function __construct() {}
66 66
 
67
-    /**
68
-     * set the phpunit configuration file
69
-     *
70
-     * @param string $file the path or filename of the phunit configuration file
71
-     */
72
-    public static function setConfigurationFile($file)
73
-    {
74
-        static::$file = $file;
75
-    }
67
+	/**
68
+	 * set the phpunit configuration file
69
+	 *
70
+	 * @param string $file the path or filename of the phunit configuration file
71
+	 */
72
+	public static function setConfigurationFile($file)
73
+	{
74
+		static::$file = $file;
75
+	}
76 76
 
77
-    /**
78
-     * get the phpunit test suite instance
79
-     *
80
-     * @return PHPUnit_Framework_TestSuite returns the phpunit test suite instance
81
-     * @throws FileNotFoundException       if the file is not found
82
-     */
83
-    public static function suite()
84
-    {
85
-        $file = static::checkConfigurationFile(
86
-            static::getConfigurationFile()
87
-        );
77
+	/**
78
+	 * get the phpunit test suite instance
79
+	 *
80
+	 * @return PHPUnit_Framework_TestSuite returns the phpunit test suite instance
81
+	 * @throws FileNotFoundException       if the file is not found
82
+	 */
83
+	public static function suite()
84
+	{
85
+		$file = static::checkConfigurationFile(
86
+			static::getConfigurationFile()
87
+		);
88 88
 
89
-        return PHPUnit_Util_Configuration::getInstance($file)
90
-            ->getTestSuiteConfiguration();
91
-    }
89
+		return PHPUnit_Util_Configuration::getInstance($file)
90
+			->getTestSuiteConfiguration();
91
+	}
92 92
 
93
-    /**
94
-     * get the phpunit configuration file
95
-     *
96
-     * @return string
97
-     */
98
-    private static function getConfigurationFile()
99
-    {
100
-        static::$file = isset(static::$file)
101
-            ? static::$file
102
-            : TESTPATH.'phpunit.xml';
93
+	/**
94
+	 * get the phpunit configuration file
95
+	 *
96
+	 * @return string
97
+	 */
98
+	private static function getConfigurationFile()
99
+	{
100
+		static::$file = isset(static::$file)
101
+			? static::$file
102
+			: TESTPATH.'phpunit.xml';
103 103
 
104
-        return static::$file;
105
-    }
104
+		return static::$file;
105
+	}
106 106
 
107
-    /**
108
-     * check the given file
109
-     *
110
-     * @param  string                $file file to check
111
-     * @return string                returns the file if it is valid
112
-     * @throws FileNotFoundException if the file is not found
113
-     */
114
-    private static function checkConfigurationFile($file)
115
-    {
116
-        if (!file_exists($file)) {
117
-            throw new \RuntimeException("The requested phpunit configuration was not found at $file");
118
-        }
107
+	/**
108
+	 * check the given file
109
+	 *
110
+	 * @param  string                $file file to check
111
+	 * @return string                returns the file if it is valid
112
+	 * @throws FileNotFoundException if the file is not found
113
+	 */
114
+	private static function checkConfigurationFile($file)
115
+	{
116
+		if (!file_exists($file)) {
117
+			throw new \RuntimeException("The requested phpunit configuration was not found at $file");
118
+		}
119 119
 
120
-        return $file;
121
-    }
120
+		return $file;
121
+	}
122 122
 }
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/CIPHPUnitTestRequest.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,9 +10,9 @@
 block discarded – undo
10 10
 
11 11
 class CIPHPUnitTestRequest
12 12
 {
13
-    /**
14
-     * @var TestCase
15
-     */
13
+	/**
14
+	 * @var TestCase
15
+	 */
16 16
 	protected $testCase;
17 17
 
18 18
 	/**
Please login to merge, or discard this patch.
lib/Installer.php 1 patch
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -10,202 +10,202 @@
 block discarded – undo
10 10
 
11 11
 class Installer
12 12
 {
13
-    private $silent = false;
14
-    private $app_dir = 'application';
15
-    private $pub_dir = 'public';
16
-    private $test_dir = 'tests';
17
-    private $from_composer = false;
18
-
19
-    public function __construct($argv)
20
-    {
21
-        $this->parse_args($argv);
22
-    }
23
-
24
-    private function parse_args($argv)
25
-    {
26
-        $argc = count($argv);
27
-
28
-        if ($argc === 1) {
29
-            return;
30
-        }
31
-
32
-        for ($i = 1; $i <= $argc; $i++) {
33
-            if (! isset($argv[$i])) {
34
-                break;
35
-            }
36
-
37
-            switch ($argv[$i]) {
38
-                // php install.php -s
39
-                case '-s':
40
-                    $this->silent = true;
41
-                    break;
42
-
43
-                // php install.php -a application
44
-                case '-a':
45
-                    if (is_dir($argv[$i+1])) {
46
-                        $this->app_dir = $argv[$i+1];
47
-                    } else {
48
-                        throw new Exception('No such directory: '.$argv[$i+1]);
49
-                    }
50
-                    $i++;
51
-                    break;
52
-
53
-                // php install.php -p public
54
-                case '-p':
55
-                    if (is_dir($argv[$i+1])) {
56
-                        $this->pub_dir = $argv[$i+1];
57
-                    } else {
58
-                        throw new Exception('No such directory: '.$argv[$i+1]);
59
-                    }
60
-                    $i++;
61
-                    break;
62
-
63
-                case '--from-composer':
64
-                    $this->from_composer = true;
65
-                    $i++;
66
-                    break;
67
-
68
-                default:
69
-                    throw new Exception('Unknown argument: '.$argv[$i]);
70
-            }
71
-        }
72
-    }
73
-
74
-    public function install()
75
-    {
76
-        $this->recursiveCopy(
77
-            dirname(dirname(__FILE__)).'/application/tests',
78
-            $this->app_dir.'/'.$this->test_dir
79
-        );
80
-        $this->fixPath();
81
-        if ($this->from_composer) {
82
-            $this->recursiveUnlink($this->app_dir.'/'.$this->test_dir.'/_ci_phpunit_test');
83
-        }
84
-    }
85
-
86
-    /**
87
-     * Fix paths in Bootstrap.php
13
+	private $silent = false;
14
+	private $app_dir = 'application';
15
+	private $pub_dir = 'public';
16
+	private $test_dir = 'tests';
17
+	private $from_composer = false;
18
+
19
+	public function __construct($argv)
20
+	{
21
+		$this->parse_args($argv);
22
+	}
23
+
24
+	private function parse_args($argv)
25
+	{
26
+		$argc = count($argv);
27
+
28
+		if ($argc === 1) {
29
+			return;
30
+		}
31
+
32
+		for ($i = 1; $i <= $argc; $i++) {
33
+			if (! isset($argv[$i])) {
34
+				break;
35
+			}
36
+
37
+			switch ($argv[$i]) {
38
+				// php install.php -s
39
+				case '-s':
40
+					$this->silent = true;
41
+					break;
42
+
43
+				// php install.php -a application
44
+				case '-a':
45
+					if (is_dir($argv[$i+1])) {
46
+						$this->app_dir = $argv[$i+1];
47
+					} else {
48
+						throw new Exception('No such directory: '.$argv[$i+1]);
49
+					}
50
+					$i++;
51
+					break;
52
+
53
+				// php install.php -p public
54
+				case '-p':
55
+					if (is_dir($argv[$i+1])) {
56
+						$this->pub_dir = $argv[$i+1];
57
+					} else {
58
+						throw new Exception('No such directory: '.$argv[$i+1]);
59
+					}
60
+					$i++;
61
+					break;
62
+
63
+				case '--from-composer':
64
+					$this->from_composer = true;
65
+					$i++;
66
+					break;
67
+
68
+				default:
69
+					throw new Exception('Unknown argument: '.$argv[$i]);
70
+			}
71
+		}
72
+	}
73
+
74
+	public function install()
75
+	{
76
+		$this->recursiveCopy(
77
+			dirname(dirname(__FILE__)).'/application/tests',
78
+			$this->app_dir.'/'.$this->test_dir
79
+		);
80
+		$this->fixPath();
81
+		if ($this->from_composer) {
82
+			$this->recursiveUnlink($this->app_dir.'/'.$this->test_dir.'/_ci_phpunit_test');
83
+		}
84
+	}
85
+
86
+	/**
87
+	 * Fix paths in Bootstrap.php
88 88
 	 *
89 89
 	 * @FIXME Too ad hoc. Must rewrite, because can't handle complex paths.
90
-     */
91
-    private function fixPath()
92
-    {
93
-        $file = $this->app_dir.'/'.$this->test_dir.'/Bootstrap.php';
94
-        $contents = file_get_contents($file);
95
-
96
-        if (! file_exists('system')) {
97
-            if (file_exists('vendor/codeigniter/framework/system')) {
98
-                $contents = str_replace(
99
-                    '$system_path = \'../../system\';',
100
-                    '$system_path = \'../../vendor/codeigniter/framework/system\';',
101
-                    $contents
102
-                );
103
-            } else {
104
-                throw new Exception('Can\'t find "system" folder.');
105
-            }
106
-        }
107
-
108
-        if (! file_exists('index.php')) {
109
-            if (file_exists($this->pub_dir.'/index.php')) {
110
-                // CodeIgniter 3.0.6 and after
111
-                $contents = str_replace(
112
-                    "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);",
113
-                    "define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').DIRECTORY_SEPARATOR);",
114
-                    $contents
115
-                );
116
-                // CodeIgniter 3.0.5 and before
117
-                $contents = str_replace(
118
-                    "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');",
119
-                    "define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').'/');",
120
-                    $contents
121
-                );
122
-            } elseif (file_exists($this->app_dir.'/public/index.php')) {
123
-                // CodeIgniter 3.0.6 and after
124
-                $contents = str_replace(
125
-                    "define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);",
126
-                    "define('FCPATH', realpath(dirname(__FILE__).'/../public').DIRECTORY_SEPARATOR);",
127
-                    $contents
128
-                );
129
-                // CodeIgniter 3.0.5 and before
130
-                $contents = str_replace(
131
-                    "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');",
132
-                    "define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');",
133
-                    $contents
134
-                );
135
-                if ($this->app_dir !== 'application') {
136
-                    $contents = str_replace(
137
-                        "\$application_folder = '../../application';",
138
-                        "\$application_folder = '../../{$this->app_dir}';",
139
-                        $contents
140
-                    );
141
-                }
142
-            } else {
143
-                throw new Exception('Can\'t find "index.php".');
144
-            }
145
-        }
146
-
147
-        file_put_contents($file, $contents);
148
-    }
149
-
150
-    public function update()
151
-    {
152
-        $target_dir = $this->app_dir.'/'.$this->test_dir.'/_ci_phpunit_test';
153
-        $this->recursiveUnlink($target_dir);
154
-        $this->recursiveCopy(
155
-            dirname(dirname(__FILE__)).'/application/tests/_ci_phpunit_test',
156
-            $target_dir
157
-        );
158
-    }
159
-
160
-    /**
161
-     * Recursive Copy
162
-     *
163
-     * @param string $src
164
-     * @param string $dst
165
-     */
166
-    private function recursiveCopy($src, $dst)
167
-    {
168
-        @mkdir($dst, 0755);
169
-
170
-        $iterator = new \RecursiveIteratorIterator(
171
-            new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS),
172
-            \RecursiveIteratorIterator::SELF_FIRST
173
-        );
174
-
175
-        foreach ($iterator as $file) {
176
-            if ($file->isDir()) {
177
-                @mkdir($dst.'/'.$iterator->getSubPathName());
178
-            } else {
179
-                $success = copy($file, $dst.'/'.$iterator->getSubPathName());
180
-                if ($success) {
181
-                    if (! $this->silent) {
182
-                        echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL;
183
-                    }
184
-                }
185
-            }
186
-        }
187
-    }
188
-
189
-    /**
190
-     * Recursive Unlink
191
-     *
192
-     * @param string $dir
193
-     */
194
-    private function recursiveUnlink($dir)
195
-    {
196
-        $iterator = new \RecursiveIteratorIterator(
197
-            new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS),
198
-            \RecursiveIteratorIterator::CHILD_FIRST
199
-        );
200
-
201
-        foreach ($iterator as $file) {
202
-            if ($file->isDir()) {
203
-                rmdir($file);
204
-            } else {
205
-                unlink($file);
206
-            }
207
-        }
208
-
209
-        rmdir($dir);
210
-    }
90
+	 */
91
+	private function fixPath()
92
+	{
93
+		$file = $this->app_dir.'/'.$this->test_dir.'/Bootstrap.php';
94
+		$contents = file_get_contents($file);
95
+
96
+		if (! file_exists('system')) {
97
+			if (file_exists('vendor/codeigniter/framework/system')) {
98
+				$contents = str_replace(
99
+					'$system_path = \'../../system\';',
100
+					'$system_path = \'../../vendor/codeigniter/framework/system\';',
101
+					$contents
102
+				);
103
+			} else {
104
+				throw new Exception('Can\'t find "system" folder.');
105
+			}
106
+		}
107
+
108
+		if (! file_exists('index.php')) {
109
+			if (file_exists($this->pub_dir.'/index.php')) {
110
+				// CodeIgniter 3.0.6 and after
111
+				$contents = str_replace(
112
+					"define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);",
113
+					"define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').DIRECTORY_SEPARATOR);",
114
+					$contents
115
+				);
116
+				// CodeIgniter 3.0.5 and before
117
+				$contents = str_replace(
118
+					"define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');",
119
+					"define('FCPATH', realpath(dirname(__FILE__).'/../../{$this->pub_dir}').'/');",
120
+					$contents
121
+				);
122
+			} elseif (file_exists($this->app_dir.'/public/index.php')) {
123
+				// CodeIgniter 3.0.6 and after
124
+				$contents = str_replace(
125
+					"define('FCPATH', realpath(dirname(__FILE__).'/../..').DIRECTORY_SEPARATOR);",
126
+					"define('FCPATH', realpath(dirname(__FILE__).'/../public').DIRECTORY_SEPARATOR);",
127
+					$contents
128
+				);
129
+				// CodeIgniter 3.0.5 and before
130
+				$contents = str_replace(
131
+					"define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');",
132
+					"define('FCPATH', realpath(dirname(__FILE__).'/../public').'/');",
133
+					$contents
134
+				);
135
+				if ($this->app_dir !== 'application') {
136
+					$contents = str_replace(
137
+						"\$application_folder = '../../application';",
138
+						"\$application_folder = '../../{$this->app_dir}';",
139
+						$contents
140
+					);
141
+				}
142
+			} else {
143
+				throw new Exception('Can\'t find "index.php".');
144
+			}
145
+		}
146
+
147
+		file_put_contents($file, $contents);
148
+	}
149
+
150
+	public function update()
151
+	{
152
+		$target_dir = $this->app_dir.'/'.$this->test_dir.'/_ci_phpunit_test';
153
+		$this->recursiveUnlink($target_dir);
154
+		$this->recursiveCopy(
155
+			dirname(dirname(__FILE__)).'/application/tests/_ci_phpunit_test',
156
+			$target_dir
157
+		);
158
+	}
159
+
160
+	/**
161
+	 * Recursive Copy
162
+	 *
163
+	 * @param string $src
164
+	 * @param string $dst
165
+	 */
166
+	private function recursiveCopy($src, $dst)
167
+	{
168
+		@mkdir($dst, 0755);
169
+
170
+		$iterator = new \RecursiveIteratorIterator(
171
+			new \RecursiveDirectoryIterator($src, \RecursiveDirectoryIterator::SKIP_DOTS),
172
+			\RecursiveIteratorIterator::SELF_FIRST
173
+		);
174
+
175
+		foreach ($iterator as $file) {
176
+			if ($file->isDir()) {
177
+				@mkdir($dst.'/'.$iterator->getSubPathName());
178
+			} else {
179
+				$success = copy($file, $dst.'/'.$iterator->getSubPathName());
180
+				if ($success) {
181
+					if (! $this->silent) {
182
+						echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL;
183
+					}
184
+				}
185
+			}
186
+		}
187
+	}
188
+
189
+	/**
190
+	 * Recursive Unlink
191
+	 *
192
+	 * @param string $dir
193
+	 */
194
+	private function recursiveUnlink($dir)
195
+	{
196
+		$iterator = new \RecursiveIteratorIterator(
197
+			new \RecursiveDirectoryIterator($dir, \RecursiveDirectoryIterator::SKIP_DOTS),
198
+			\RecursiveIteratorIterator::CHILD_FIRST
199
+		);
200
+
201
+		foreach ($iterator as $file) {
202
+			if ($file->isDir()) {
203
+				rmdir($file);
204
+			} else {
205
+				unlink($file);
206
+			}
207
+		}
208
+
209
+		rmdir($dir);
210
+	}
211 211
 }
Please login to merge, or discard this patch.