Permalink
Browse files

unit tests for edit Label

  • Loading branch information...
1 parent bb11c89 commit 7dba0df231f11d546fe04f2ca2c652828557182e @nprasath002 nprasath002 committed Oct 13, 2012
Showing with 55 additions and 4 deletions.
  1. +55 −4 tests/suites/unit/joomla/github/JGithubIssuesTest.php
@@ -185,8 +185,8 @@ public function testCreateLabel()
$returnData->body = $this->sampleString;
$issue = new stdClass;
- $issue->name = 'Label';
- $issue->color = 'blue';
+ $issue->name = 'My Insightful Label';
+ $issue->color = 'My Insightful Color';
$this->client->expects($this->once())
->method('post')
@@ -213,8 +213,8 @@ public function testCreateLabelFailure()
$returnData->body = $this->errorString;
$issue = new stdClass;
- $issue->name = 'Label';
- $issue->color = 'green';
+ $issue->name = 'My Insightful Label';
+ $issue->color = 'My Insightful Color';
$this->client->expects($this->once())
->method('post')
@@ -412,6 +412,57 @@ public function testEditCommentFailure()
}
/**
+ * Tests the editLabel method
+ *
+ * @return void
+ */
+ public function testEditLabel()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 200;
+ $returnData->body = $this->sampleString;
+
+ $issue = new stdClass;
+ $issue->name = 'This label is now even more insightful';
+ $issue->color = 'This color is now even more insightful';
+
+ $this->client->expects($this->once())
+ ->method('patch')
+ ->with('/repos/joomla/joomla-platform/labels/523', json_encode($issue))
+ ->will($this->returnValue($returnData));
+
+ $this->assertThat(
+ $this->object->editLabel('joomla', 'joomla-platform', 523, 'This label is now even more insightful', 'This color is now even more insightful'),
+ $this->equalTo(json_decode($this->sampleString))
+ );
+ }
+
+ /**
+ * Tests the editComment method - failure
+ *
+ * @expectedException DomainException
+ *
+ * @return void
+ */
+ public function testEditLabelFailure()
+ {
+ $returnData = new stdClass;
+ $returnData->code = 500;
+ $returnData->body = $this->errorString;
+
+ $issue = new stdClass;
+ $issue->name = 'This label is now even more insightful';
+ $issue->color = 'This color is now even more insightful';
+
+ $this->client->expects($this->once())
+ ->method('patch')
+ ->with('/repos/joomla/joomla-platform/labels/523', json_encode($issue))
+ ->will($this->returnValue($returnData));
+
+ $this->object->editLabel('joomla', 'joomla-platform', 523, 'This label is now even more insightful', 'This color is now even more insightful');
+ }
+
+ /**
* Tests the get method
*
* @return void

0 comments on commit 7dba0df

Please sign in to comment.