Пример #1
0
 /**
  * Tweet by optionally uploading media and updating status.
  *
  * @param Tweet $tweet
  */
 public function tweet(Tweet $tweet)
 {
     if ($tweet->getMedia() instanceof StreamInterface) {
         $tweet = $this->mediaUploader->upload($tweet);
     }
     $this->statusUpdater->update($tweet);
 }
Пример #2
0
 /**
  * Test a Tweet with media.
  */
 public function testTweeterWithMedia()
 {
     $stream = $this->getMock('Psr\\Http\\Message\\StreamInterface');
     $tweet = $this->getMock('JimLind\\Pie7o\\Tweet');
     $tweet->method('getMedia')->willReturn($stream);
     $taggedTweet = $this->getMock('JimLind\\Pie7o\\Tweet');
     $this->mediaUploader->expects($this->once())->method('upload')->with($tweet)->willReturn($taggedTweet);
     $this->statusUpdater->expects($this->once())->method('update')->with($taggedTweet);
     $this->fixture->tweet($tweet);
 }
Пример #3
0
 /**
  * Test GuzzleClient with good response.
  */
 public function testGuzzleClientResponseGood()
 {
     $response = $this->getMock('GuzzleHttp\\Psr7\\Response');
     $response->method('getStatusCode')->willReturn(200);
     $this->guzzleClient->method('send')->willReturn($response);
     $stream = $this->getMock('Psr\\Http\\Message\\StreamInterface');
     $tweet = $this->getMock('JimLind\\Pie7o\\Tweet');
     $tweet->method('getMessage')->willReturn($stream);
     $actual = $this->fixture->update($tweet);
     $this->assertNull($actual);
 }