/** * @return mixed */ protected function call() { $projectName = $this->loader->getProjectName(); $projectKey = null; try { $projects = $this->api->getProjects()->json(); foreach ($projects as $project) { if ($project['name'] == $projectName) { $projectKey = $project['project_key']; break; } } if ($projectKey === null) { $response = $this->api->postProject($this->loader->getComposerJson()); } else { $response = $this->api->updateProject($projectKey, $this->loader->getComposerJson()); } } catch (\Exception $e) { return new VersionEyeResult(VersionEyeResult::STATUS_ERR); } return new VersionEyeResult(VersionEyeResult::STATUS_OK, $response->json()); }
/** * @test */ public function testUpdateProject() { $projectKey = 'foo_1'; $result = $this->object->updateProject($projectKey, __DIR__ . '/Fixtures/composer.json'); $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $result); }