semsol / arc2

ARC RDF Classes for PHP
Other
332 stars 89 forks source link

Setup PHPUnit environment and fixed tests #83

Closed k00ni closed 7 years ago

k00ni commented 7 years ago

Summary: I reworked the PHPUnit setup by first, adding it to composer.json and secondly, added a bootstrap.php in the test folder with basic includes.

Afterwards i adapted some test classes to get the test suite going. From now on, to run the test suite, just install vendors using composer update and run vendor/bin/phpunit in the terminal:

bash-4.3# vendor/bin/phpunit
PHPUnit 6.2.1 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.0.17 with Xdebug 2.5.4
Configuration: /var/www/html/phpunit.xml

........................................                          40 / 40 (100%)

Time: 93 ms, Memory: 6.00MB

OK (40 tests, 114 assertions)

Highlights:

bnowack commented 7 years ago

Awesome stuff, thank you. Must be a pain with all that outdated code...

k00ni commented 7 years ago

"Surprisingly" not :D

All tests run fine on PHP 5.6, 7.0 and 7.1 without any deeper adaptions. Saw other libraries which broke after running under PHP 7.0.

Btw. i am one of the main developers of Saft (here some outdated documentation), a high level RDF library for PHP, which main objective is to integrate major libraries like ARC2, Erfurt and EasyRdf. For ARC2, i have added support for SPARQL UPDATE (besides other stuff and fixes) so that ARC2 can handle queries like:

DELETE WHERE {
     Graph <http://localhost/Saft/TestGraph/> {
         ?s ?p ?o .
     }
}

We built the ARC2 class around your ARC2 classes, but support currently only store functionality. For instance, it intercepts queries and adapts them, if not supported by ARC2 (like the pasted DELETE WHERE query). That way, i can avoid most of the pain you mentioned (^_^)