OOP Wrapper for Facebook Test Users API

If you have a tight Facebook integration in your project and it's time for tests, there's a useful test users API with a simple GUI as well as a programmatic access.

Since I worked on automatic testing with behat BDD framework, I've created a simple oop wrapper with Guzzle for their json API. It's easy to install and configure, just use composer

$ php composer.phar require --dev rinatio/Facebook:~0.1

then configure namespaces, set your Facebook application credentials

use rinatio\Facebook\Test\User as TestUser;
use rinatio\Facebook\Facebook;


and you're ready to go:

// create a user
$user = TestUser::create(array(
    'name' => 'Jack Black'
echo $user->access_token;
echo $user->login_url;

// add a friend
$friend = TestUser::create(array(
    'name' => 'John White'

// Get full user profile
echo $user->username;
echo $user->gender;

// Get all test users created in your app
$users = TestUser::all();

// Delete a user

// Or delete all of them
comments powered by Disqus
Made with in SPb