PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Tests/Security/Authentication/Token/FacebookUserTokenTest.php

http://github.com/FriendsOfSymfony/FOSFacebookBundle
PHP | 48 lines | 26 code | 8 blank | 14 comment | 0 complexity | 85dae1676167ce29964fcadca3d984df MD5 | raw file
 1<?php
 2
 3/*
 4 * This file is part of the FOSFacebookBundle package.
 5 *
 6 * (c) FriendsOfSymfony <http://friendsofsymfony.github.com/>
 7 *
 8 * For the full copyright and license information, please view the LICENSE
 9 * file that was distributed with this source code.
10 */
11
12namespace FOS\FacebookBundle\Tests\Security\Authentication\Token;
13
14use FOS\FacebookBundle\Security\Authentication\Token\FacebookUserToken;
15
16class FacebookUserTokenTest extends \PHPUnit_Framework_TestCase
17{
18    /**
19     * @dataProvider provider
20     */
21    public function testThatAlwaysReturnEmptyCredentials($uid, $roles)
22    {
23        $token = new FacebookUserToken('main', $uid, $roles);
24
25        $this->assertEquals('', $token->getCredentials());
26    }
27
28    /**
29     * @return array
30     */
31    public static function provider()
32    {
33        return array(
34            array('', array()),
35            array('l3l0', array()),
36            array('', array('role1', 'role2')),
37            array('l3l0', array('role1', 'role2'))
38        );
39    }
40
41    public function testThatProviderKeyIsNotEmptyAfterDeserialization()
42    {
43        $providerKey = 'main';
44        $token = unserialize(serialize(new FacebookUserToken($providerKey)));
45
46        $this->assertEquals($providerKey, $token->getProviderKey());
47    }
48}