Ejemplo n.º 1
0
 public function testInit()
 {
     echo "\n\ntesting init\n\n";
     $tempDir = $this->createTempDir();
     $app = new ComposerUI($tempDir);
     $options = array('name' => 'test/test', 'author' => $app->makeAuthorString('TestAuthor', '*****@*****.**'), 'description' => 'a test package', 'homepage' => 'http://example.com', 'require' => array($app->createFullPackageName('seld/jsonlint', '1.0'), $app->createFullPackageName('nesbot/carbon', '1.0')), 'require-dev' => array($app->createFullPackageName('phpunit/phpunit', '3.7.*')), 'stability' => 'dev', 'license' => 'MIT');
     $this->assertTrue($app->init($options));
     $this->assertFileExists($tempDir . DIRECTORY_SEPARATOR . 'composer.json');
     $json = JsonFile::parseJson(file_get_contents($tempDir . DIRECTORY_SEPARATOR . 'composer.json'));
     $this->assertArrayHasKey('name', $json);
     $this->assertArrayHasKey('require', $json);
     $this->assertArrayHasKey('authors', $json);
     $this->assertArrayHasKey('description', $json);
     $this->assertArrayHasKey('homepage', $json);
 }