public function testShowJsonFileOutput() { $expectedResult = $this->composerLocator->getJsonFile(); $this->expectOutputString($expectedResult); $composerServer = new ComposerServer($this->composerLocator); $composerServer->showJsonFile(true); }
public function testGetJsonFile() { $expected = $this->minifyJson(file_get_contents($this->testProjectFolder . DIRECTORY_SEPARATOR . 'composer.json')); $cl = new ComposerLocator(new Filesystem(), $this->testPackageFolder . DIRECTORY_SEPARATOR . '..'); $actual = $cl->getJsonFile(); $this->assertJson($actual, 'The composer.json file does not contain valid JSON.'); $this->assertEquals($expected, $actual); }
/** * Sends the composer.json file to $this->url * * @param string $apiKey * * @return bool eturns true on success (HTTP 200) */ public function sendJsonFile($apiKey) { $response = $this->client->get($this->url, ['headers' => ['Authorization' => 'apiKey:' . $apiKey], 'body' => $this->composerLocator->getJsonFile()]); return $response->getStatusCode() == 200; }
/** * @param bool $send if true sends the headers & contents to the browser * * @return Response */ public function showJsonFile($send = false) { $response = $this->createResponse($this->composerLocator->getJsonFile()); return $send ? $response->send() : $response; }