Skip to content

Commit 42da6ef

Browse files
committed
XMLReaderIterator v0.1.10.
- fixed many issues (thanks again David Paz) - build: fixed cwdname() - build: phpunit vendor windows platform support - build: always, ignore errors - added safe cwd handling in examples test - added allowed skipping in example tests - added xmlseq stream-wrapper de-regristation in tests - added regex expectations in examples test - ci: init travis
1 parent 409d64f commit 42da6ef

26 files changed

Lines changed: 250 additions & 103 deletions

.travis.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
language: php
2+
3+
php:
4+
- 5.3
5+
- 5.4
6+
- 5.5
7+
- 5.6
8+
- nightly
9+
- hhvm
10+
11+
matrix:
12+
allow_failures:
13+
- php: nightly
14+
- php: hhvm
15+
16+
before_install:
17+
- travis_retry composer self-update
18+
19+
install:
20+
- travis_retry composer install --prefer-source --no-interaction --ignore-platform-reqs
21+
22+
before_script:
23+
- ./build.sh
24+
25+
script:
26+
- vendor/bin/phpunit --debug --stop-on-error --stop-on-failure

COPYING

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,4 +658,4 @@ specific requirements.
658658
You should also get your employer (if you work as a programmer) or school,
659659
if any, to sign a "copyright disclaimer" for the program, if necessary.
660660
For more information on this, and how to apply and follow the GNU AGPL, see
661-
<http://www.gnu.org/licenses/>.
661+
<http://www.gnu.org/licenses/>.

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Iterators for [PHP `XMLReader`](http://php.net/XMLReader) for ease of parsing
22

3-
### Changelog:
3+
### Change Log:
4+
5+
- `0.1.10` maintenance release with fixes.
46

57
- `0.1.9` maintenance release with fixes. added XMLReaderNode::expand().
68

build.php

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of the XMLReaderIterator package.
55
*
6-
* Copyright (C) 2012, 2013, 2014 hakre <http://hakre.wordpress.com>
6+
* Copyright (C) 2012, 2013, 2014, 2015 hakre <http://hakre.wordpress.com>
77
*
88
* build script
99
*/
@@ -50,28 +50,27 @@ function built_test_git_tag($version, &$errors)
5050
build_test_tests($errors);
5151

5252
if ($errors) {
53-
printf("ERROR: Build (Tests only) had %d errors, quitting.\n", $errors);
54-
55-
return;
53+
// printf("ERROR: Build (Tests only) had %d errors, quitting.\n", $errors);
54+
// return;
5655
}
5756

5857
### clean ###
5958
build_make_clean($errors, $buildDir, $concatenateDir);
6059

6160
### create concatenateFile ###
6261
build_create_concatenate_file($errors, $concatenateFile, $autoLoadFile, $readmeVersion);
63-
copy_file_to_dir('README.md', $concatenateDir);
62+
copy_file_to_dir(__DIR__ . '/README.md', $concatenateDir);
6463

6564
### conditional build target into gist ###
66-
$gistDir = __DIR__ . '/../' . basename(__dir__) . '-Gist-5147685';
65+
$gistDir = __DIR__ . '/../' . basename(__DIR__) . '-Gist-5147685';
6766
if (is_dir($gistDir)) {
6867
copy_dir_to_dir($concatenateDir, $gistDir);
6968
} else {
7069
printf("INFO: Gist build target directory not found.\n");
7170
}
7271

7372
if ($errors) {
74-
printf("ERROR: Build had %d errors.\n");
73+
printf("ERROR: Build had %d errors.\n", $errors);
7574
}
7675

7776
/**
@@ -86,8 +85,8 @@ function built_test_readme_get_version(&$errors)
8685
$version = null;
8786

8887
foreach ($data as $index => $line ) {
89-
if ($line === "### Changelog:\n") {
90-
$version = preg_match('~`(\d\.\d\.\d)`~', $data[$index + 2], $m) ? $m[1] : null;
88+
if ($line === "### Change Log:\n") {
89+
$version = preg_match('~`(\d\.\d+\.\d+)`~', $data[$index + 2], $m) ? $m[1] : null;
9190
}
9291
if ($index > 10) {
9392
break;
@@ -107,7 +106,7 @@ function built_test_readme_get_version(&$errors)
107106

108107
function built_validate_version($version, &$errors)
109108
{
110-
if (!preg_match('~^\d.\d.\d$~', $version)) {
109+
if (!preg_match('~^\d\.\d+\.\d+$~', $version)) {
111110
echo "ERROR: Unable to validate version '$version'.\n";
112111
$errors++;
113112
return false;
@@ -143,7 +142,7 @@ function built_test_composer_validate_json(&$errors)
143142

144143
$command = "$composer --no-ansi --version";
145144

146-
$lastline = exec($command, $output, $exitCode);
145+
exec($command, $output, $exitCode);
147146
list($versionLine) = $output;
148147
if (!preg_match('~^Composer version (?:1.0-dev \([0-9a-f]{40}\)|[0-9a-f]{40}) 2\d{3}-(?:0\d|1[0-2])-(?:[0-2]\d|3[0-1]) (?:[0-1]\d|2[0-3]):[0-5]\d:(?:[0-5]\d|60)$~', $versionLine)) {
149148
echo "ERROR: Unable to invoke Composer.\n";
@@ -172,12 +171,16 @@ function build_test_tests(&$errors)
172171
{
173172
echo "INFO: Running phpunit testuite before building:\n";
174173

175-
$phpunit = 'phpunit';
174+
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
175+
$phpunit = '.\vendor\bin\phpunit.bat';
176+
} else {
177+
$phpunit = './vendor/bin/phpunit';
178+
}
176179

177180
$command = "$phpunit --version";
178181

179-
$lastline = exec($command, $output, $exitCode);
180-
list($versionLine) = $output;
182+
exec($command, $output, $exitCode);
183+
list($versionLine) = $output + array(null);
181184
if (!preg_match('~^PHPUnit \d\.\d\.\d+ by Sebastian Bergmann\.$~', $versionLine)) {
182185
echo "ERROR: Unable to invoke PHPUnit.\n";
183186
$errors++;
@@ -228,9 +231,10 @@ function build_test_autoload_file(&$errors, $autoLoadFile)
228231
}
229232

230233
/**
231-
* @param $errors
232-
* @param $concatenateFile
233-
* @param $autoLoadFile
234+
* @param int $errors
235+
* @param string $concatenateFile
236+
* @param string $autoLoadFile
237+
* @param string $version
234238
*
235239
* @internal param $buildDir
236240
* @internal param $concatenateFileHandle
@@ -405,16 +409,17 @@ function fseek_first_empty_line($handle)
405409
function cwdname($path)
406410
{
407411
static $base;
408-
$base || $base = realpath('.');
409-
$result = realpath($path);
412+
isset($base) || $base = realpath('.');
410413

411-
if (substr($result, 0, strlen($base)) === $base) {
412-
$result = '.' . substr($result, strlen($base));
413-
} else {
414+
$baseLen = strlen($base);
415+
if (substr($path, 0 , $baseLen) !== $base or !strpos(' ' . '\\/', $path[$baseLen])) {
414416
echo "INFO: File '$path' not relative to cwd. Please verify.\n";
417+
$relative = realpath($path);
418+
} else {
419+
$relative = ltrim(substr($path, $baseLen), '\\/');
415420
}
416421

417-
return strtr($result, '\\', '/');
422+
return strtr($relative, '\\', '/');
418423
}
419424

420425
/**

build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
# build script on clean checkout
44
#
55

6+
if [ -n "TRAVIS" ]; then
7+
echo "build on travis with php ${TRAVIS_PHP_VERSION}"
8+
if [ "${TRAVIS_PHP_VERSION}" == "5.2" ]; then
9+
echo "5.2 is not a composer version, can't build, exiting."
10+
exit 0
11+
fi
12+
fi
13+
614
if [ ! -d vendor ]; then
715
echo "installing build dependencies..."
816
composer install

build/include/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
## Iterators for [PHP `XMLReader`](http://php.net/XMLReader) for ease of parsing
22

3-
### Changelog:
3+
### Change Log:
4+
5+
- `0.1.10` maintenance release with fixes.
46

57
- `0.1.9` maintenance release with fixes. added XMLReaderNode::expand().
68

0 commit comments

Comments
 (0)