/** * Test AuthorizationBuilder is called correctly. * * Short circuit the output with an exception * * @expectedException JimLind\Pie7o\Pie7oException * @expectedExceptionMessage Could Not Upload Media: `` */ public function testAuthorizationBuilderCalled() { $method = 'POST'; $url = 'https://upload.twitter.com/1.1/media/upload.json'; $post = []; $this->authorizationBuilder->expects($this->once())->method('build')->with($method, $url, $post); $this->guzzleClient->method('send')->will($this->throwException(new Exception())); $stream = $this->getMock('Psr\\Http\\Message\\StreamInterface'); $tweet = $this->getMock('JimLind\\Pie7o\\Tweet'); $tweet->method('getMedia')->willReturn($stream); $this->fixture->upload($tweet); }
/** * Test sendTwitterRequest called with default post data. */ public function testSendTwitterRequestWithDefaultPostData() { $this->authorizationBuilder->expects($this->once())->method('build')->with('POST', 'https://', []); $tweet = $this->getMock('JimLind\\Pie7o\\Tweet'); $this->callFixtureWithTweet($tweet); }