/** * @param PharComposer $pharcomposer * @depends testConstructor */ public function testSetters(PharComposer $pharcomposer) { $pharcomposer->setMain('example/phar-composer.php'); $this->assertEquals('example/phar-composer.php', $pharcomposer->getMain()); $pharcomposer->setTarget('test.phar'); $this->assertEquals('test.phar', $pharcomposer->getTarget()); return $pharcomposer; }
public function getSystemBin(PharComposer $pharer, $path = null) { // no path given => place in system bin path if ($path === null) { $path = self::PATH_BIN; } // no slash => path is relative to system bin path if (strpos($path, '/') === false) { $path = self::PATH_BIN . '/' . $path; } // TODO: check path is in $PATH environment // path is actually a directory => append package name if (is_dir($path)) { $path = rtrim($path, '/') . '/' . basename($pharer->getTarget(), '.phar'); } return $path; }
<?php use Clue\PharComposer\PharComposer; require __DIR__ . '/../vendor/autoload.php'; $pharcomposer = new PharComposer(__DIR__ . '/../composer.json'); $pharcomposer->build();