Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1261 from mariansollmann/issue-1261
Browse files Browse the repository at this point in the history
Add ip to createRequest mock in test helper
  • Loading branch information
Marian Sollmann committed Jun 5, 2014
2 parents 7483fd0 + 3b82a45 commit c4495be
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests/helpers/CMTest/library/CMTest/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,19 +161,21 @@ public function getResponseForm($formClassName, $actionName, array $data, $compo
/**
* @param string $url
* @param array $query
* @return CM_Request_Post
* @return CM_Request_Post|PHPUnit_Framework_MockObject_MockObject
*/
public function createRequest($url, array $query = null) {
$url = (string) $url;
$request = $this->getMockBuilder('CM_Request_Post')->setConstructorArgs(array($url))->setMethods(array('getQuery'))->getMock();
$ip = '16909060';
$request = $this->getMockBuilder('CM_Request_Post')->setConstructorArgs(array($url))->setMethods(array('getQuery', 'getIp'))->getMock();
$request->expects($this->any())->method('getQuery')->will($this->returnValue($query));
$request->expects($this->any())->method('getIp')->will($this->returnValue($ip));
return $request;
}

/**
* @param CM_FormAction_Abstract $action
* @param array|null $data
* @return CM_Request_Post
* @return CM_Request_Post|PHPUnit_Framework_MockObject_MockObject
*/
public function createRequestFormAction(CM_FormAction_Abstract $action, array $data = null) {
$actionName = $action->getName();
Expand Down

0 comments on commit c4495be

Please sign in to comment.