Skip to content

Commit 2cbd128

Browse files
committed
Updated namespace in PHPUnit_BaseClass and added .editorconfig
1 parent 37460dc commit 2cbd128

File tree

4 files changed

+56
-12
lines changed

4 files changed

+56
-12
lines changed

.editorconfig

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# EditorConfig helps developers define and maintain consistent
2+
# coding styles between different editors and IDEs
3+
# editorconfig.org
4+
5+
root = true
6+
7+
8+
[*]
9+
10+
# change these settings to your own preference
11+
indent_style = space
12+
indent_size = 4
13+
14+
# we recommend you to keep these unchanged
15+
end_of_line = lf
16+
charset = utf-8
17+
trim_trailing_whitespace = true
18+
insert_final_newline = true
19+
20+
[*.md]
21+
trim_trailing_whitespace = false
22+
23+
[*.json]
24+
indent_style = space
25+
indent_size = 2
26+
27+
[*.html]
28+
indent_style = space
29+
indent_size = 2
30+
31+
[*.sublime-project]
32+
indent_style = tab
33+
indent_size = 4

tests/_PHPUnit_BaseClass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function _hQuery_Test_autoloader($class) {
2626
* @backupGlobals disabled
2727
*/
2828
// -----------------------------------------------------
29-
abstract class PHPUnit_BaseClass extends PHPUnit_Framework_TestCase {
29+
abstract class PHPUnit_BaseClass extends PHPUnit\Framework\TestCase {
3030
public static $log = true;
3131
public static $testName;
3232
public static $className;

tests/hQuery.Test.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,12 @@ public function testClass() {
6969
$this->assertMehodExists('fromHTML', self::$className);
7070
$this->assertMehodExists('fromFile', self::$className);
7171
$this->assertMehodExists('fromURL' , self::$className);
72-
72+
7373
// $f = glob(PHPUNIT_DIR . 'data/*');
7474
// foreach($f as $k => $v) if(is_file($v) && substr($v, -3) != '.gz') {
7575
// $g = gzencode(file_get_contents($v), 9);
7676
// file_put_contents($v.'.gz', $g);
77-
// }
77+
// }
7878
}
7979

8080
// -----------------------------------------------------
@@ -115,7 +115,7 @@ public function test_find() {
115115
$this->assertEquals('test-div', $a->parent->attr('id'));
116116

117117
// 2)
118-
118+
119119
$ff = TestHQueryTests::fromFile(self::file_exists('data/attr.html'));
120120
$aa = $ff->find('a.aa');
121121
$this->assertEquals(3, count($aa));
@@ -213,4 +213,4 @@ public function test_jsonize($vars) {
213213
// -----------------------------------------------------
214214

215215
}
216-
?>
216+
?>

tools/test_watcher.js

+18-7
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,30 @@ function run_test_async() {
107107

108108
function check_phpunit_phar(cb) {
109109
if ( !fs.existsSync(_phpunit_path) ) {
110-
var file = fs.createWriteStream(_phpunit_path);
111-
http.get(_phpunit_url, function(response) {
112-
response.pipe(file);
113-
response.on('end', function (err) {
114-
cb(err);
115-
});
116-
});
110+
download(_phpunit_url, _phpunit_path, 7, cb);
117111
}
118112
else {
119113
cb();
120114
}
121115
}
122116

117+
function download(srcUrl, filePath, maxRedirects, cb) {
118+
return http.get(srcUrl, function onGet(response) {
119+
var statusCode = response.statusCode;
120+
var newUrl = response.headers.location;
121+
console.log('↓', srcUrl, '→', statusCode);
122+
if ( statusCode >= 300 && statusCode < 400 && newUrl ) {
123+
if ( !maxRedirects-- ) {
124+
return cb(new Error('Redirects detected (to "'+newUrl+'"")'));
125+
}
126+
return download(newUrl, filePath, maxRedirects, cb);
127+
}
128+
var file = fs.createWriteStream(filePath);
129+
response.pipe(file);
130+
response.on('end', cb);
131+
});
132+
}
133+
123134
check_phpunit_phar(function () {
124135
var testcase = process.argv[2];
125136
_test_file = get_test_file_path(testcase);

0 commit comments

Comments
 (0)