public function testAddBranch() { $project = Utils::addProject(); $file = Utils::addFile($project); $commit = new Commit(); $commit->setRevision($file->getCommit()->getRevision()); $branch = new Branch(); $branch->setName(Utils::randomString()); $branch->setCommit($commit); $resp = Utils::getBuddy()->getApiBranches()->addBranch($branch, Utils::getWorkspaceDomain(), $project->getName()); $this->assertInstanceOf('Buddy\\Objects\\Branch', $resp); $this->assertEquals($branch->getName(), $resp->getName()); $this->assertEquals('', $resp->getDescription()); $this->assertEquals(false, $resp->getDefault()); $this->assertInstanceOf('Buddy\\Objects\\Commit', $resp->getCommit()); }
public function addBranch() { try { $buddy = new Buddy(['accessToken' => 'yourAccessToken']); $branch = new Branch(); $head = new Commit(); $head->setRevision('branch head revision'); $branch->setName('dev'); $branch->setCommit($head); $resp = $buddy->getApiBranches()->addBranch($branch, 'domain', 'projectName'); var_dump($resp); exit; } catch (BuddyResponseException $e) { echo $e->getMessage(); exit; } catch (BuddySDKException $e) { echo $e->getMessage(); exit; } }