class GoogleAuthManagerTest in Social Auth Google 8
@coversDefaultClass Drupal\social_auth_google\GoogleAuthManager @group social_auth_google
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\social_auth_google\Unit\GoogleAuthManagerTest
Expanded class hierarchy of GoogleAuthManagerTest
File
- tests/
src/ Unit/ GoogleAuthManagerTest.php, line 12
Namespace
Drupal\Tests\social_auth_google\UnitView source
class GoogleAuthManagerTest extends UnitTestCase {
/**
* Session object.
*
* @var \Symfony\Component\HttpFoundation\Session\Session
*/
protected $session;
/**
* Request object.
*
* @var \Symfony\Component\HttpFoundation\Request
*/
protected $request;
/**
* Google Client object.
*
* @var \Google_Client
*/
protected $client;
/**
* Google Authentication manager.
*
* @var \Drupal\social_auth_google\GoogleAuthManager
*/
protected $googleManager;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->session = $this
->getMock('\\Symfony\\Component\\HttpFoundation\\Session\\Session');
$this->request = $this
->getMock('\\Symfony\\Component\\HttpFoundation\\RequestStack');
$this->googleManager = new GoogleAuthManager($this->session, $this->request);
$this->client = $this
->getMockBuilder('\\Google_Client')
->disableOriginalConstructor()
->getMock();
}
/**
* Tests set Google_Client object.
*
* @covers ::setClient
*/
public function testSetGoogleClient() {
$this
->assertInstanceOf('Drupal\\social_auth_google\\GoogleAuthManager', $this
->setClient());
}
/**
* Tests get Google_Client object.
*
* @covers ::getClient
* @covers ::saveAccessToken
* @covers ::createService
*/
public function testGetGoogleClient() {
$this
->setClient();
$this
->assertInstanceOf('Google_Client', $this->googleManager
->getClient());
}
/**
* Sets \Google_Client object to GoogleAuthManager.
*
* @return \Drupal\social_auth_google\GoogleAuthManager
* setClient() returns $this, the GoogleAuthManager object.
*/
protected function setClient() {
return $this->googleManager
->setClient($this->client);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GoogleAuthManagerTest:: |
protected | property | Google Client object. | |
GoogleAuthManagerTest:: |
protected | property | Google Authentication manager. | |
GoogleAuthManagerTest:: |
protected | property | Request object. | |
GoogleAuthManagerTest:: |
protected | property | Session object. | |
GoogleAuthManagerTest:: |
protected | function | Sets \Google_Client object to GoogleAuthManager. | |
GoogleAuthManagerTest:: |
protected | function |
Overrides UnitTestCase:: |
|
GoogleAuthManagerTest:: |
public | function | Tests get Google_Client object. | |
GoogleAuthManagerTest:: |
public | function | Tests set Google_Client object. | |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |