public function testSeePostOnFacebookWithAttachedPlace() { // precondition #1: I have facebook user $this->module->haveFacebookTestUserAccount(); // precondition #2: I have published the post with place attached $params = array('place' => '141971499276483'); $this->facebook->api('me/feed', 'POST', $params); // assert that post was published in the facebook and place is the same $this->module->seePostOnFacebookWithAttachedPlace($params['place']); }
/** * * Please, note that you must have publish_stream permission to be able to publish to user's feed. * * @param string $placeId Place identifier to be verified against user published posts */ public function seePostOnFacebookWithAttachedPlace($placeId) { $posts = $this->facebook->getLastPostsForTestUser(); if ($posts['data']) { foreach ($posts['data'] as $post) { if (array_key_exists('place', $post) && $post['place']['id'] == $placeId) { return; // success } } } $this->fail('Failed to see post on Facebook with attached place with id ' . $placeId); }
/** * * Please, note that you must have publish_actions permission to be able to publish to user's feed. * * @param string $message published post to be verified against the actual post on facebook */ public function seePostOnFacebookWithMessage($message) { $posts = $this->facebook->getLastPostsForTestUser($this->grabFacebookTestUserAccessToken()); $facebook_post_message = ''; $this->assertNotEquals($message, $facebook_post_message, "You can not test for an empty message post"); if ($posts['data']) { foreach ($posts['data'] as $post) { if (array_key_exists('message', $post) && $post['message'] == $message) { $facebook_post_message = $post['message']; } } } $this->assertEquals($message, $facebook_post_message, "The post message was not found on facebook page"); }