Esempio n. 1
0
 public function update()
 {
     $dir = $this->getDirectory();
     $updater = new \Dxw\Whippet\Dependencies\Updater($this->factory, $dir);
     $installer = new \Dxw\Whippet\Dependencies\Installer($this->factory, $dir);
     $this->exitIfError($updater->update());
     $this->exitIfError($installer->install());
 }
Esempio n. 2
0
 public function testUpdateWithBrokenJson()
 {
     $dir = $this->getDir();
     $whippetJson = $this->getWhippetJson(['src' => ['plugins' => 'git@git.dxw.net:wordpress-plugins/'], 'themes' => [['name' => 'my-theme', 'ref' => 'v1.4']], 'plugins' => [['name' => 'my-plugin', 'ref' => 'v1.6']]]);
     $this->addFactoryCallStatic('\\Dxw\\Whippet\\Files\\WhippetJson', 'fromFile', $dir . '/whippet.json', \Result\Result::ok($whippetJson));
     file_put_contents($dir . '/whippet.json', 'foobar');
     $gitignore = $this->getGitignore([], ["/wp-content/themes/my-theme\n", "/wp-content/plugins/my-plugin\n"], false, false);
     $this->addFactoryNewInstance('\\Dxw\\Whippet\\Git\\Gitignore', $dir, $gitignore);
     $whippetLock = $this->getWhippetLockWritable([], sha1('foobar'), null, []);
     $this->addFactoryCallStatic('\\Dxw\\Whippet\\Files\\WhippetLock', 'fromFile', $dir . '/whippet.lock', \Result\Result::ok($whippetLock));
     $this->addFactoryCallStatic('\\Dxw\\Whippet\\Git\\Git', 'ls_remote', 'git@git.dxw.net:wordpress-themes/my-theme', 'v1.4', \Result\Result::ok('27ba906'));
     $this->addFactoryCallStatic('\\Dxw\\Whippet\\Git\\Git', 'ls_remote', 'git@git.dxw.net:wordpress-plugins/my-plugin', 'v1.6', \Result\Result::ok('d961c3d'));
     $dependencies = new \Dxw\Whippet\Dependencies\Updater($this->getFactory(), $this->getProjectDirectory($dir));
     ob_start();
     $result = $dependencies->update();
     $output = ob_get_clean();
     $this->assertTrue($result->isErr());
     $this->assertEquals('missing sources', $result->getErr());
     $this->assertEquals("[Updating themes/my-theme]\n", $output);
 }