public function testParsePostArray() { // Get sample response $sampleResponse = $this->sampleResponses['post.json']; $response = new Response($sampleResponse, 'json'); // Get parser $parser = new TwitterParser($response); // Parse data $post = $parser->parsePostArray($response->getArray()); // Test post $this->assertInstanceOf('\\Evolution7\\SocialApi\\Entity\\Post', $post); $this->assertEquals('250075927172759552', $post->getId()); $this->assertEquals('Aggressive Ponytail #freebandnames', $post->getBody()); $this->assertNull($post->getMediaType()); $this->assertNull($post->getMediaUrl()); $dateTime = new \DateTime(); $dateTime->setTimestamp(strtotime('Mon Sep 24 03:35:21 +0000 2012')); $this->assertEquals($dateTime, $post->getCreated()); // Test user $user = $post->getUser(); $this->assertInstanceOf('\\Evolution7\\SocialApi\\Entity\\User', $user); $this->assertEquals('137238150', $user->getId()); $this->assertEquals('sean_cummings', $user->getHandle()); $this->assertEquals('https://twitter.com/sean_cummings', $user->getUrl()); $this->assertEquals('Sean Cummings', $user->getName()); $this->assertEquals('//si0.twimg.com/profile_images/2359746665/1v6zfgqo8g0d3mk7ii5s_normal.jpeg', $user->getImageUrl()); }
public function testParsePostArray() { // Get sample response $sampleResponse = $this->sampleResponses['post.json']; $response = new Response($sampleResponse, 'json'); // Get parser $parser = new InstagramParser($response); // Parse data $post = $parser->parsePostArray($response->getArray()); // Test post $this->assertInstanceOf('\\Evolution7\\SocialApi\\Entity\\Post', $post); $this->assertEquals('3', $post->getId()); $this->assertEquals('Hello world', $post->getBody()); $this->assertEquals('image', $post->getMediaType()); $this->assertEquals('//distillery.s3.amazonaws.com/media/2010/07/16/4de37e03aa4b4372843a7eb33fa41cad_7.jpg', $post->getMediaUrl()); $dateTime = new \DateTime(); $dateTime->setTimestamp(1279340983); $this->assertEquals($dateTime, $post->getCreated()); // Test user $user = $post->getUser(); $this->assertInstanceOf('\\Evolution7\\SocialApi\\Entity\\User', $user); $this->assertEquals('3', $user->getId()); $this->assertEquals('kevin', $user->getHandle()); $this->assertEquals('http://instagram.com/kevin', $user->getUrl()); $this->assertEquals('Kevin S', $user->getName()); $this->assertEquals('...', $user->getImageUrl()); }