Skip to content
Permalink
Browse files

Remove use of TestCase::getMock() from "Network" namepace tests.

  • Loading branch information...
ADmad committed Jun 5, 2016
1 parent 029f041 commit 07e390bacf68131562e0f6cebc54b56728d5c81c
@@ -100,10 +100,9 @@ class StreamTest extends TestCase
public function setUp()
{
parent::setUp();
$this->stream = $this->getMock(
'Cake\Network\Http\Adapter\Stream',
['_send']
);
$this->stream = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['_send'])
->getMock();
stream_wrapper_register('cakephp', __NAMESPACE__ . '\CakeStreamWrapper');
}
@@ -33,10 +33,9 @@ public function setUp()
{
parent::setUp();
$this->client = $this->getMock(
'Cake\Network\Http\Client',
['send']
);
$this->client = $this->getMockBuilder('Cake\Network\Http\Client')
->setMethods(['send'])
->getMock();
$this->auth = new Digest($this->client);
}
@@ -167,7 +167,9 @@ public function testGetSimpleWithHeadersAndCookies()
'split' => 'value'
];
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->once())
->method('send')
->with($this->logicalAnd(
@@ -196,7 +198,9 @@ public function testGetQuerystring()
{
$response = new Response();
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->once())
->method('send')
->with($this->logicalAnd(
@@ -226,7 +230,9 @@ public function testGetQuerystringString()
{
$response = new Response();
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->once())
->method('send')
->with($this->logicalAnd(
@@ -257,7 +263,9 @@ public function testGetWithContent()
{
$response = new Response();
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->once())
->method('send')
->with($this->logicalAnd(
@@ -286,7 +294,9 @@ public function testGetWithContent()
*/
public function testInvalidAuthenticationType()
{
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->never())
->method('send');
@@ -308,7 +318,9 @@ public function testGetWithAuthenticationAndProxy()
{
$response = new Response();
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$headers = [
'Connection' => 'close',
'User-Agent' => 'CakePHP',
@@ -363,7 +375,9 @@ public function testMethodsSimple($method)
{
$response = new Response();
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->once())
->method('send')
->with($this->logicalAnd(
@@ -413,7 +427,9 @@ public function testPostWithTypeKey($type, $mime)
'Accept' => $mime,
];
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->once())
->method('send')
->with($this->logicalAnd(
@@ -445,7 +461,9 @@ public function testPostWithStringDataDefaultsToFormEncoding()
'Content-Type' => 'application/x-www-form-urlencoded',
];
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->any())
->method('send')
->with($this->logicalAnd(
@@ -471,7 +489,9 @@ public function testPostWithStringDataDefaultsToFormEncoding()
*/
public function testExceptionOnUnknownType()
{
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->never())
->method('send');
@@ -489,10 +509,9 @@ public function testExceptionOnUnknownType()
*/
public function testCookieStorage()
{
$adapter = $this->getMock(
'Cake\Network\Http\Adapter\Stream',
['send']
);
$adapter = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$cookieJar = $this->getMockBuilder('Cake\Network\Http\CookieCollection')->getMock();
$headers = [
@@ -533,7 +552,9 @@ public function testHeadQuerystring()
{
$response = new Response();
$mock = $this->getMock('Cake\Network\Http\Adapter\Stream', ['send']);
$mock = $this->getMockBuilder('Cake\Network\Http\Adapter\Stream')
->setMethods(['send'])
->getMock();
$mock->expects($this->once())
->method('send')
->with($this->logicalAnd(
@@ -2314,7 +2314,9 @@ public function testSetInput()
*/
public function testInput()
{
$request = $this->getMock('Cake\Network\Request', ['_readInput']);
$request = $this->getMockBuilder('Cake\Network\Request')
->setMethods(['_readInput'])
->getMock();
$request->expects($this->once())->method('_readInput')
->will($this->returnValue('I came from stdin'));
@@ -2329,7 +2331,9 @@ public function testInput()
*/
public function testInputDecode()
{
$request = $this->getMock('Cake\Network\Request', ['_readInput']);
$request = $this->getMockBuilder('Cake\Network\Request')
->setMethods(['_readInput'])
->getMock();
$request->expects($this->once())->method('_readInput')
->will($this->returnValue('{"name":"value"}'));
@@ -2351,7 +2355,9 @@ public function testInputDecodeExtraParams()
</post>
XML;
$request = $this->getMock('Cake\Network\Request', ['_readInput']);
$request = $this->getMockBuilder('Cake\Network\Request')
->setMethods(['_readInput'])
->getMock();
$request->expects($this->once())->method('_readInput')
->will($this->returnValue($xml));
Oops, something went wrong.

0 comments on commit 07e390b

Please sign in to comment.
You can’t perform that action at this time.