Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

unit tests for creating label

  • Loading branch information...
commit 04b9d65eca4dc7211045818d0ebc33748ca0080d 1 parent 5d85471
@nprasath002 authored
Showing with 51 additions and 0 deletions.
  1. +51 −0 tests/suites/unit/joomla/github/JGithubIssuesTest.php
View
51 tests/suites/unit/joomla/github/JGithubIssuesTest.php
@@ -174,6 +174,57 @@ public function testCreateCommentFailure()
}
/**
+ * Tests the createLabel method
+ *
+ * @return void
+ */
+ public function testCreateLabel()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 201;
+ $returnData->body = $this->sampleString;
+
+ $issue = new stdClass;
+ $issue->name = 'Label';
+ $issue->color = 'blue';
+
+ $this->client->expects($this->once())
+ ->method('post')
+ ->with('/repos/joomla/joomla-platform/labels', json_encode($issue))
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->createLabel('joomla', 'joomla-platform', 'Label', 'blue'),
+ $this->equalTo(json_decode($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the createLabel method - failure
+ *
+ * @expectedException DomainException
+ *
+ * @return void
+ */
+ public function testCreateLabelFailure()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 501;
+ $returnData->body = $this->errorString;
+
+ $issue = new stdClass;
+ $issue->name = 'Label';
+ $issue->color = 'green';
+
+ $this->client->expects($this->once())
+ ->method('post')
+ ->with('/repos/joomla/joomla-platform/labels', json_encode($issue))
+ ->will($this->returnValue($returnData));
+
+ $this->object->createLabel('joomla', 'joomla-platform', 'Label', 'blue');
+ }
+
+ /**
* Tests the deleteComment method
*
* @return void
Please sign in to comment.
Something went wrong with that request. Please try again.