Open mjordan opened 6 years ago
Bump on this, so it doesn't get too far out of date.
@mjordan I just ran a fresh install of MIK and attempted to run the unit tests. When running the tests against this pull-request I get the following error 46 times:
Error: An iterator cannot be used with foreach by reference
This does not happen when I run PHPUnit against the master branch (as of commit https://github.com/MarcusBarnes/mik/commit/22012800261bd3050ad6ab99615ad0bea919a096). @bondjimbond Are you able to confirm this PHPUnit behaviour? I'd like to confirm that this is not just an issue related to my local development environment. I get the same result if I use the version included in the MIK vendor folder and also another version I have on my system. (To run the PHPUnit tests in MIK, make sure you're in the MIK folder cd MIK/
, then run php vendor/bin/phpunit
).
@MarcusBarnes Sorry for taking so long to respond to this. In this branch I get the same errors you do when running phpunit. In the master branch and others I don't get the errors.
@bondjimbond Thanks for confirming that you see the same behaviour. I'd like to address the errors we're seeing when running the tests before merging.
I'm wondering if we're hitting a PHP7 thing here.... I've seen some changes in behavior in 7.2 for example that have broken some things in MIK.
@mjordan I'm running PHP 7.1.16.
OK, I'll test again with 7.2.10, which is what I'm currently running.
Running this now on a clean clone of MIK and the tests fail as well, even in the master branch:
PHP Warning: is_dir() expects parameter 1 to be a valid path, object given in /usr/share/php/PHPUnit/Runner/BaseTestRunner.php on line 56
PHP Recoverable fatal error: Object of class PHPUnit\Framework\TestSuite could not be converted to string in /usr/share/php/PHPUnit/Runner/StandardTestSuiteLoader.php on line 32
Hm... is the error you guys are getting the same one reported at https://github.com/MarcusBarnes/mik/pull/465#issuecomment-387408313 ? Mine is:
git checkout issue-451
Switched to branch 'issue-451'
Your branch is up to date with 'origin/issue-451'.
mark@mark-ThinkPad-X1-Carbon-6th:/tmp/mik$ ./mik -c issue-451.ini
Commencing MIK.
PHP Fatal error: Uncaught Error: An iterator cannot be used with foreach by reference in /tmp/mik/src/fetchers/Csv.php:93
Stack trace:
#0 /tmp/mik/src/fetchers/Csv.php(128): mik\fetchers\Csv->getRecords()
#1 /tmp/mik/mik(131): mik\fetchers\Csv->getNumRecs()
#2 {main}
thrown in /tmp/mik/src/fetchers/Csv.php on line 93
Github issue: #451
What does this Pull Request do?
Adds a metadata manipulator that appends an element containing a UUID to metadata XML created by the Templated metadata parser.
What's new?
A new metadata manipulator. It takes a Twig template like
and appends it to the output of the Templated metadata parser, like this:
How should this be tested?
This PR has a PHPUnit test but should also get a smoke test.
To run PHPUnit tests, in the MIK directory, run
phpunit
. You should getTests: 57, Assertions: 88, Skipped: 1.
To perform a smoketest:
composer dump-autoload
./mik -c issue-451.ini
Look at the XML files generated by MIK. They all should have a UUID element at the bottom.
issue-451.zip
Additional Notes
Yes, a wiki entry for this manipulator is at https://github.com/MarcusBarnes/mik/wiki/Metadata-manipulator:-AddUuidToTemplated.
A note about this manipulator should also be added to https://github.com/MarcusBarnes/mik/wiki/Cookbook:-Templated-Metadata-Parser.
Interested parties
@MarcusBarnes @bondjimbond