Skip to content

Commit

Permalink
Added missing requirements for phingofficial#826 (phingofficial#931)
Browse files Browse the repository at this point in the history
  • Loading branch information
siad007 authored and mrook committed Jun 11, 2018
1 parent 4043609 commit cfa1752
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
7 changes: 7 additions & 0 deletions docs/guide/en/source/appendixes/optionaltasks.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4391,6 +4391,13 @@ Note that you can omit both startpoint and track attributes in this case
<entry>n/a</entry>
<entry>No</entry>
</row>
<row>
<entry><literal>responseCodeRegex</literal></entry>
<entry><literal role="type">String</literal></entry>
<entry>The regular expression for matching the response code</entry>
<entry>n/a</entry>
<entry>No</entry>
</row>
<row>
<entry><literal>authUser</literal></entry>
<entry><literal role="type">String</literal></entry>
Expand Down
3 changes: 3 additions & 0 deletions etc/phing-grammar.rng
Original file line number Diff line number Diff line change
Expand Up @@ -3885,6 +3885,9 @@
<optional>
<attribute name="responseregex"/>
</optional>
<optional>
<attribute name="responsecoderegex"/>
</optional>
<optional>
<attribute name="authuser"/>
</optional>
Expand Down
7 changes: 7 additions & 0 deletions test/classes/phing/tasks/ext/HTTP/HttpRequestTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ public function testMatchesRegexp()
$this->expectLog('recipient', 'The response body matched the provided regex.');
}

public function testMatchesCodeRegexp()
{
$this->copyTasksAddingCustomRequest('matchesCodeRegexp', 'recipient', $this->createRequestWithMockAdapter());

$this->expectLog('recipient', 'The response status-code matched the provided regex.');
}

/**
* @expectedException BuildException
* @expectedExceptionMessage The received response body did not match the given regular expression
Expand Down
8 changes: 6 additions & 2 deletions test/etc/tasks/ext/http/httprequest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@
</target>

<target name="matchesRegexp">
<http-request url="http://example.com/" responseRegex="/foo/" />
<http-request url="http://example.com/" responseRegex="foo" />
</target>

<target name="matchesCodeRegexp">
<http-request url="http://example.com/" responseCodeRegex="200" />
</target>

<target name="doesNotMatchRegexp">
<http-request url="http://example.com/" responseRegex="/bar/" />
<http-request url="http://example.com/" responseRegex="bar" />
</target>

<target name="post">
Expand Down

0 comments on commit cfa1752

Please sign in to comment.