示例#1
0
 /**
  * @covers ::init
  * @covers ::output
  * @covers ::isInitialized
  * @covers ::config
  * @covers ::getConfiguration
  * @depends testCreation
  */
 public function testInitialization()
 {
     $this->assertFalse(Git::isInitialized(self::$git->getPath()));
     $this->assertRegExp('/^Initiali(s|z)ed empty Git repository in/', self::$git->init()->output());
     $this->assertTrue(Git::isInitialized(self::$git->getPath()));
     $this->assertCount(1, $history = self::$git->history());
     // reinitialization should have no effect
     $this->assertRegExp('/^Initiali(s|z)ed empty Git repository in/', self::$git->init()->output());
     $this->assertCount(1, $newHistory = self::$git->history());
     $this->assertEquals($history, $newHistory);
     // configuring the user.email and user.name
     self::$git->config('user.email', $email = '*****@*****.**');
     self::$git->config('user.name', $name = 'Giovanni Gioffreda');
     $this->assertEquals($email, trim(self::$git->config('user.email')->output()));
     $this->assertEquals($name, trim(self::$git->config('user.name')->output()));
     $configuration = self::$git->getConfiguration();
     $this->assertArrayHasKey('user.email', $configuration);
     $this->assertArrayHasKey('user.name', $configuration);
 }