add new test which validate correct Exception in Resository::create this thrown if $params fails.

Merged
#22 · Created  · Last updated

Merged pull request

Merged in gerryghall/bitbucket-api (pull request #22)

29f92c7·Author: ·Closed by: ·2015-07-13

Description

the following test asserts the correct exception with the $params parameter fails validation.

/** * @param $check * @param $expectation * @return mixed * @expectedException \InvalidArgumentException * @dataProvider invalidCreateProvider */ public function testInvalidCreate($check) { $client = $this->getHttpClientMock(); /** @var \Bitbucket\API\Repositories\Repository $repo */ $repo = $this->getClassMock('Bitbucket\API\Repositories\Repository', $client); $this->setExpectedException('\InvalidArgumentException'); $repo->create('gentle', 'new-repo', $check); } public function testCreateRepositoryFromJSON() { $endpoint = 'repositories/gentle/new-repo'; $params = json_encode(array( 'scm' => 'git', 'name' => 'new-repo', 'is_private' => true, 'description' => 'My secret repo', 'forking_policy' => 'no_public_forks', )); $client = $this->getHttpClientMock(); $client->expects($this->once()) ->method('post') ->with($endpoint, $params); /** @var \Bitbucket\API\Repositories\Repository $repo */ $repo = $this->getClassMock('Bitbucket\API\Repositories\Repository', $client); $repo->create('gentle', 'new-repo', $params); }

0 attachments

0 comments

Loading commits...