public function testConstruction() { // with key $updater = new Updater($this->files . '/test.phar'); $this->assertEquals($updater->getLocalPharFile(), $this->files . '/test.phar'); $this->assertEquals($updater->getLocalPubKeyFile(), $this->files . '/test.phar.pubkey'); // without key $updater = new Updater($this->files . '/test.phar', false); $this->assertEquals($updater->getLocalPharFile(), $this->files . '/test.phar'); $this->assertNull($updater->getLocalPubKeyFile()); // no name - detect running console app $updater = new Updater(null, false); $this->assertStringEndsWith('phpunit.phar', basename($updater->getLocalPharFile(), '.phar') . '.phar'); }
/** * Retrieve the current version of the local phar file. * * @param Updater $updater * @return string */ public function getCurrentLocalVersion(Updater $updater) { return sha1_file($updater->getLocalPharFile()); }