Skip to content
Browse files

unit test for getting labels

  • Loading branch information...
1 parent 7dba0df commit 534b55b207e0e8480b7e32c918784d8713c1ceef @nprasath002 nprasath002 committed Oct 13, 2012
Showing with 86 additions and 0 deletions.
  1. +86 −0 tests/suites/unit/joomla/github/JGithubIssuesTest.php
View
86 tests/suites/unit/joomla/github/JGithubIssuesTest.php
@@ -592,6 +592,92 @@ public function testGetCommentsFailure()
}
/**
+ * Tests the getLabel method
+ *
+ * @return void
+ */
+ public function testGetLabel()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/repos/joomla/joomla-platform/labels/My Insightful Label')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getLabel('joomla', 'joomla-platform', 'My Insightful Label'),
+ $this->equalTo(json_decode($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getLabel method - failure
+ *
+ * @expectedException DomainException
+ *
+ * @return void
+ */
+ public function testGetLabelFailure()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 500;
+ $returnData->body = $this->errorString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/repos/joomla/joomla-platform/issues/comments/523')
+ ->will($this->returnValue($returnData));
+
+ $this->object->getLabel('joomla', 'joomla-platform', 'My Insightful Label');
+ }
+
+ /**
+ * Tests the getLabels method
+ *
+ * @return void
+ */
+ public function testGetLabels()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/repos/joomla/joomla-platform/labels')
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->getLabels('joomla', 'joomla-platform'),
+ $this->equalTo(json_decode($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the getLabels method - failure
+ *
+ * @expectedException DomainException
+ *
+ * @return void
+ */
+ public function testGetLabelsFailure()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 500;
+ $returnData->body = $this->errorString;
+
+ $this->client->expects($this->once())
+ ->method('get')
+ ->with('/repos/joomla/joomla-platform/labels')
+ ->will($this->returnValue($returnData));
+
+ $this->object->getLabels('joomla', 'joomla-platform');
+ }
+
+ /**
* Tests the getList method
*
* @return void

0 comments on commit 534b55b

Please sign in to comment.
Something went wrong with that request. Please try again.