Skip to content

Instantly share code, notes, and snippets.

@Marlinc
Created February 11, 2016 12:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marlinc/02566ebafd6bcbc367ab to your computer and use it in GitHub Desktop.
Save Marlinc/02566ebafd6bcbc367ab to your computer and use it in GitHub Desktop.
<?php
public function testStatusUpdate()
{
$client = $this->getMockBuilder('Cake\\Network\\Http\\Client')
->setMethods([
'post'
])
->getMock();
$client
->expects($this->once())
->method('post')
->with()
->willReturn(new Response([
'HTTP/1.1 200 Ok'
], json_encode([
'id' => 1234,
'text' => 'Test123'
])));
$this->webservice->driver()->client($client);
$query = new Query($this->webservice, new Endpoint());
$query->create();
$query->set([
'text' => 'Test123'
]);
$resource = $this->webservice->execute($query);
$this->assertInstanceOf('Muffin\\Webservice\\Model\\Resource', $resource);
$this->assertEquals($resource->text, 'Test123');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment