oauth2-client/test/src/Entity/UserTest.php

65 lines
1.5 KiB
PHP
Raw Normal View History

2014-04-28 22:00:26 +04:00
<?php
2015-01-08 14:17:22 +03:00
namespace League\OAuth2\Client\Test\Entity;
2014-04-28 22:00:26 +04:00
use League\OAuth2\Client\Entity\User;
class UserTest extends \PHPUnit_Framework_TestCase
{
private $user;
2014-04-28 22:00:26 +04:00
private $userArray;
public function setUp()
{
2014-11-09 00:30:40 +03:00
$this->user = new User();
2014-04-28 22:00:26 +04:00
2014-11-09 00:30:40 +03:00
$this->userArray = [
2014-04-28 22:00:26 +04:00
'uid' => 'mock_uid',
'nickname' => 'mock_nickname',
'name' => 'mock_name',
'firstName' => 'mock_firstName',
'lastName' => 'mock_lastName',
'email' => 'mock_email',
'location' => 'mock_location',
'description' => 'mock_description',
'imageUrl' => 'mock_imageUrl',
'urls' => 'mock_urls',
'gender' => 'mock_gender',
2014-11-09 00:30:40 +03:00
'locale' => 'mock_locale',
];
2014-04-28 22:00:26 +04:00
}
public function testExchangeArrayGetArrayCopy()
{
$this->user->exchangeArray($this->userArray);
2014-04-28 22:00:26 +04:00
$this->assertEquals($this->userArray, $this->user->getArrayCopy());
}
public function testMagicMethos()
{
$this->user->exchangeArray($this->userArray);
2014-04-28 22:00:26 +04:00
$this->user->name = 'mock_change_test';
$this->assertTrue(isset($this->user->name));
2014-04-28 22:00:26 +04:00
$this->assertEquals('mock_change_test', $this->user->name);
}
/**
* @expectedException \OutOfRangeException
2014-04-28 22:00:26 +04:00
*/
public function testInvalidMagicSet()
{
$this->user->invalidProp = 'mock';
}
/**
* @expectedException \OutOfRangeException
2014-04-28 22:00:26 +04:00
*/
public function testInvalidMagicGet()
{
$this->user->invalidProp;
2014-04-28 22:00:26 +04:00
}
}