List the Git branches for a site
public listBranches ( string $site_id ) : Consolidation\OutputFormatters\StructuredData\RowsOfFields | ||
$site_id | string | The name of the site to list the branches of |
Результат | Consolidation\OutputFormatters\StructuredData\RowsOfFields |
/** * Tests the branch:list command */ public function testListBranches() { $branches_info = [['id' => 'master', 'sha' => 'xxx'], ['id' => 'another', 'sha' => 'yyy']]; $branches = []; foreach ($branches_info as $branch_info) { $branch = $this->getMockBuilder(Branch::class)->disableOriginalConstructor()->getMock(); $branch->expects($this->once())->method('serialize')->willReturn($branch_info); $branches[] = $branch; } $branches_collection = $this->getMockBuilder(Branches::class)->disableOriginalConstructor()->getMock(); $branches_collection->expects($this->once())->method('all')->willReturn($branches); $this->site->expects($this->once())->method('getBranches')->willReturn($branches_collection); $command = new ListCommand(); $command->setSites($this->sites); $out = $command->listBranches('my-site'); $this->assertEquals($branches_info, $out->getArrayCopy()); }