Skip to content

Instantly share code, notes, and snippets.

@albertvolkman
Created May 14, 2014 15:55
Show Gist options
  • Save albertvolkman/3fa5c02de4d2b75b8e14 to your computer and use it in GitHub Desktop.
Save albertvolkman/3fa5c02de4d2b75b8e14 to your computer and use it in GitHub Desktop.
<?php
/**
* @file
* Contains AllPlayers\RestServer\Tests\Controller\Group\MemberControllerTest.
*/
namespace AllPlayers\RestServer\Tests\Controller\Group;
use AllPlayers\Tests\Selenium\Group\Registration\AdHocRegistrationTest;
use AllPlayers\Tests\Selenium\TestCase\TestCase;
use AllPlayers\Tests\Group\Fixtures\RandomGroup;
use AllPlayers\Tests\User\Fixtures\RandomUser;
use AllPlayers\Tests\Selenium\Helpers\GroupRegistration;
use AllPlayers\Tests\Selenium\Group\Registration;
/**
* Contains basic Rest Server Tests.
*
* @package AllPlayers\RestServer\Tests\Controller\Group
*/
class MemberControllerTest extends TestCase
{
/**
* A group to test registration.
*
* @var RandomGroup $group
*/
protected static $group;
/**
* An administrator for the group.
*
* @var RandomUser $group_admin
*/
protected static $groupAdmin;
/**
* The number of users to create.
*
* @var int
*/
protected static $userCount = 5;
/**
* The test client.
*
* @var
*/
private $client;
public static function setUpBeforeClass()
{
// Create new group and a group admin.
self::$group = new RandomGroup();
self::$groupAdmin = new RandomUser();
$registration = new AdHocRegistrationTest();
$registration->testSetupRegistrationSettings();
}
/**
* Test AllPlayers\RestServer\Controller\Group\MemberController::getMembersAction().
*/
public function testGetMembersAction()
{
$this->client = static::createClient();
$this->client->request('GET', "/api/v2/group/$this->group/members");
//$this->client->request('GET', '/api/v2/group/a22af7fd-ff1a-11e2-9d8d-22000a929134/members');
// Verify request was successful.
$this->requestSuccessful();
// Verify resulting content.
$content = $this->client->getResponse()->getContent();
}
/**
* Assert that the request was successful.
*/
public function requestSuccessful()
{
// Assert that the request was successful.
$this->assertTrue(
$this->client->getResponse()->isSuccessful(),
'Request unsuccessful.'
);
// Assert that the "Content-Type" header is "application/json"
$this->assertTrue(
$this->client->getResponse()->headers->contains(
'Content-Type',
'application/json'
),
'"Content-Type" header should be "application/json".'
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment