diff --git a/documents/Changelog.txt b/documents/Changelog.txt index 16ef26f..0ec583e 100644 --- a/documents/Changelog.txt +++ b/documents/Changelog.txt @@ -1,7 +1,14 @@ [+]: new [~]: changed [-]: removed [#]: fixed [@]: internal -1.20.1: (2016-02-21) +1.20.2: (2016-03-04) +fixes some leaked PHP notices. + + [#] Fixed: + * fix. + + +1.20.1: internal cleanup. [@] Internal: diff --git a/documents/License.txt b/documents/License.txt index 576290b..7c881b4 100644 --- a/documents/License.txt +++ b/documents/License.txt @@ -1,4 +1,4 @@ -Copyright (c) 2015, Daniele Orlando +Copyright (c) 2016, Daniele Orlando All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/documents/ReadMe.md b/documents/ReadMe.md index 571dcf5..9c90316 100644 --- a/documents/ReadMe.md +++ b/documents/ReadMe.md @@ -48,51 +48,12 @@ ## Changelog -**1.20** (2016-02-21): -_is a major step forward breaking compatibility with the past.
-Under the hood there is a general reorganization to be `PSR-0/4` compliant,
-a general cleanup of the API for being consistent and allowing future clean APIs
-growth, some notable additions like the `->filter()` method to programmatically
-filter the query results and `->html()` to output the document as valid HTML 5
-string. Just because awesomenesses are never enough, `->query()` supports
-**CSS Selectors**._ - -### New: -* `->html()` is part of the family. -* `->filter()` is part of the family. -* `->comment()` is part of the family. -* `->setComment()` is part of the family. -* `->addComment()` is part of the family. -* `->size()` is an alias of `->length()`. -* `->__invoke()` is an alias of `->query()`. -* `->__toString()` is an alias of `->xml()`. -* `->array()` replaces `->asArray()`. -* `->addChild()` replaces `->appendChild()`. -* `->addText()` replaces `->appendText()`. -* `->addCdata()` replaces `->appendCdata()`. - -### Changed: -* `->query()` supports CSS Selectors. -* `fluidxml()` has gained the super powers of `fluidify()`. -* `FluidXml->__construct()` has gained the super powers of `FluidXml::load()`. -* `::load()/fluidify()` can be ONLY used to load an XML file. - -### Removed: -* `->asArray()` has been removed superseded by `->array()`. -* `->appendText()` has been removed superseded by `->addText()`. -* `->appendCdata()` has been removed superseded by `->addCdata()`. -* `->appendChild()` has been removed superseded by `->addChild()`. -* `->insertSiblingBefore()` has been removed superseded by `->prependSibling()`. -* `->insertSiblingAfter()` has been removed superseded by `->appendSibling()`. - -### Internal: -* `PSR-0/4` compliance. -* `FluidXml.php` is still there for people NOT using Composer/PSR-0/4 loaders. -* `FluidInsertionHandler` refactoring. +**1.20.2** (2016-03-04): +_fixes some leaked PHP notices._ **...** -[See the full changes list.][changelog] +[The full changes list.][changelog]
diff --git a/source/FluidXml/FluidContext.php b/source/FluidXml/FluidContext.php index 84acc56..3ee50a4 100644 --- a/source/FluidXml/FluidContext.php +++ b/source/FluidXml/FluidContext.php @@ -239,10 +239,10 @@ public function appendSibling($sibling, ...$optionals) // setAttribute(['name' => 'value', ...]) public function setAttribute($name, $value = null) { - $attrs = [ $name => $value ]; - if (\is_array($name)) { $attrs = $name; + } else { + $attrs = [ $name => $value ]; } foreach ($this->nodes as $n) { diff --git a/source/FluidXml/FluidNamespace.php b/source/FluidXml/FluidNamespace.php index bc4a0bf..92939a7 100644 --- a/source/FluidXml/FluidNamespace.php +++ b/source/FluidXml/FluidNamespace.php @@ -17,16 +17,6 @@ class FluidNamespace public function __construct($id, $uri, $mode = 1) { - if (\is_array($id)) { - $args = $id; - $id = $args[self::ID]; - $uri = $args[self::URI]; - - if (isset($args[self::MODE])) { - $mode = $args[self::MODE]; - } - } - $this->config[self::ID] = $id; $this->config[self::URI] = $uri; $this->config[self::MODE] = $mode; diff --git a/source/FluidXml/FluidXml.php b/source/FluidXml/FluidXml.php index bf0e542..647e7ef 100644 --- a/source/FluidXml/FluidXml.php +++ b/source/FluidXml/FluidXml.php @@ -194,8 +194,6 @@ protected function namespace_(...$arguments) } $namespaces[] = new FluidNamespace(...$args); - } elseif (\is_array($arguments[0])) { - $namespaces = $arguments[0]; } else { $namespaces = $arguments; } diff --git a/source/FluidXml/fluid.php b/source/FluidXml/fluid.php index 5e02ff9..e6cc131 100644 --- a/source/FluidXml/fluid.php +++ b/source/FluidXml/fluid.php @@ -2,7 +2,7 @@ namespace FluidXml; -define('FLUIDXML_VERSION', '1.20'); +define('FLUIDXML_VERSION', '1.20.2'); function fluidxml(...$arguments) { diff --git a/specs/FluidXml.php b/specs/FluidXml.php index c3aa47e..2f708c5 100644 --- a/specs/FluidXml.php +++ b/specs/FluidXml.php @@ -132,11 +132,13 @@ }); it('should throw for not existing file', function () { + $err_handler = \set_error_handler(function () {}); try { $xml = FluidXml::load('.impossible.xml'); } catch (\Exception $e) { $actual = $e; } + \set_error_handler($err_handler); assert_is_a($actual, \Exception::class); }); @@ -383,23 +385,6 @@ $expected = $xx_ns; \assert($actual === $expected, __($actual, $expected)); }); - - it('should accept an array of namespaces', function () { - $xml = new FluidXml(); - $x_ns = new FluidNamespace('x', 'x.com'); - $xx_ns = fluidns('xx', 'xx.com', FluidNamespace::MODE_IMPLICIT); - - $nss = $xml->namespace([ $x_ns, $xx_ns ]) - ->namespaces(); - - $actual = $nss[$x_ns->id()]; - $expected = $x_ns; - \assert($actual === $expected, __($actual, $expected)); - - $actual = $nss[$xx_ns->id()]; - $expected = $xx_ns; - \assert($actual === $expected, __($actual, $expected)); - }); }); describe('.query()', function () { @@ -2210,11 +2195,13 @@ function addchild($parent, $i) it('should throw for not writable file', function () { $xml = new FluidXml(); + $err_handler = \set_error_handler(function () {}); try { $xml->save('/.impossible/tmp/out.xml'); } catch (\Exception $e) { $actual = $e; } + \set_error_handler($err_handler); assert_is_a($actual, \Exception::class); }); @@ -2521,35 +2508,6 @@ function addchild($parent, $i) $expected = $ns_mode; \assert($actual === $expected, __($actual, $expected)); }); - - it('should accept an array with an id, an uri and an optional mode flag', function () { - $ns_id = 'x'; - $ns_uri = 'x.com'; - $ns_mode = FluidNamespace::MODE_EXPLICIT; - $args = [ FluidNamespace::ID => $ns_id, - FluidNamespace::URI => $ns_uri ]; - $ns = new FluidNamespace($args); - - $actual = $ns->id(); - $expected = $ns_id; - \assert($actual === $expected, __($actual, $expected)); - - $actual = $ns->uri(); - $expected = $ns_uri; - \assert($actual === $expected, __($actual, $expected)); - - $actual = $ns->mode(); - $expected = $ns_mode; - \assert($actual === $expected, __($actual, $expected)); - - $ns_mode = FluidNamespace::MODE_IMPLICIT; - $args[FluidNamespace::MODE] = $ns_mode; - $ns = new FluidNamespace($args); - - $actual = $ns->mode(); - $expected = $ns_mode; - \assert($actual === $expected, __($actual, $expected)); - }); }); describe('.id()', function () { diff --git a/support/peridot.php b/support/peridot.php index 2a7a85b..de53b4c 100644 --- a/support/peridot.php +++ b/support/peridot.php @@ -1,31 +1,29 @@ track(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'source'); -// }; - use Evenement\EventEmitterInterface; use Peridot\Reporter\CodeCoverage\AbstractCodeCoverageReporter; use Peridot\Reporter\CodeCoverageReporters; +// use Peridot\Plugin\Watcher\WatcherPlugin; return function (EventEmitterInterface $eventEmitter) { - (new CodeCoverageReporters($eventEmitter))->register(); + $eventEmitter->on('error', function ($errn, $msg, $file, $line) { + printf("$file:$line\n"); + printf(" $msg\n"); + }); // $eventEmitter->on('peridot.start', function (\Peridot\Console\Environment $environment) { // $environment->getDefinition()->getArgument('path')->setDefault(__DIR__ . '/../specs'); // }); + (new CodeCoverageReporters($eventEmitter))->register(); $eventEmitter->on('code-coverage.start', function (AbstractCodeCoverageReporter $reporter) { - /* - $reporter->addDirectoryToWhitelist(__DIR__ . '/../source') - ->addFilesToBlacklist([__DIR__ . '/../source/FluidXml.php56.php', - __DIR__ . '/../source/FluidXml.php70.php']); - */ $reporter->addDirectoryToWhitelist(__DIR__ . '/../source'); // $reporter->addFilesToWhitelist([__DIR__ . '/../source/FluidXml.php']); + // $reporter->addDirectoryToWhitelist(__DIR__ . '/../source') + // ->addFilesToBlacklist([__DIR__ . '/../source/FluidXml.php56.php', + // __DIR__ . '/../source/FluidXml.php70.php']); }); + + // $watcher = new WatcherPlugin($eventEmitter); + // $watcher->track(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'source'); }; diff --git a/support/tools/speedtest b/support/tools/speedtest index 2b6251f..00c9322 100755 --- a/support/tools/speedtest +++ b/support/tools/speedtest @@ -1,7 +1,7 @@ #!/usr/bin/env sh cd "$(dirname "$0")" -. ".common.sh" +. "./.common.sh" cd ../.. clear diff --git a/support/tools/test b/support/tools/test index 7d7f190..16994b9 100755 --- a/support/tools/test +++ b/support/tools/test @@ -15,7 +15,7 @@ fi phpdbg= if (test $# -ge 1) && (test $1 = 'debug') && chkcmd 'phpdbg'; then - phpdbg=phpdbg + phpdbg="phpdbg -e" fi -$phpdbg $(which peridot) -g "*.php" "./specs/" +$phpdbg "$(which peridot)" -c "./support/peridot.php" -g "*.php" "./specs/"