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