protected function assertGit(Git $git) { $this->assertEquals('branch1', $git->getBranch()); $commit = $git->getHead(); $commitClass = 'Contrib\\Bundle\\CoverallsV1Bundle\\Entity\\Git\\Commit'; $this->assertTrue($commit instanceof $commitClass); $this->assertCommit($commit); $remotes = $git->getRemotes(); $this->assertCount(1, $remotes); $remoteClass = 'Contrib\\Bundle\\CoverallsV1Bundle\\Entity\\Git\\Remote'; $this->assertTrue($remotes[0] instanceof $remoteClass); $this->assertRemote($remotes[0]); }
/** * @test * @depends setGit */ public function toArrayWithGit($object) { $remotes = array(new Remote()); $head = new Commit(); $git = new Git('master', $head, $remotes); $expected = array('git' => $git->toArray(), 'source_files' => array()); $this->assertSame($expected, $object->toArray()); $this->assertEquals(json_encode($expected), (string) $object); }