1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- <?php
- function executeWithBackup($file, $callback)
- {
- $exception = null;
- $backup = "$file.backup";
- copy($file, $backup);
- try {
- call_user_func($callback, $file);
- } catch (Exception $exception) {
-
- }
- unlink($file);
- rename($backup, $file);
- if ($exception) {
- throw $exception;
- }
- }
- function buildPackage()
- {
- passthru('onion build && pear -q package && rm package.xml');
- }
- executeWithBackup(__DIR__.'/../phpunit.xml.dist', function ($file) {
- $cfg = new SimpleXMLElement($file, null, true);
- $cfg[0]['bootstrap'] = str_replace('tests/', '', $cfg[0]['bootstrap']);
- $cfg->testsuites->testsuite->directory = str_replace('tests/', '', $cfg->testsuites->testsuite->directory);
- $cfg->saveXml($file);
- buildPackage();
- });
|