You are here

protected function SimpleFbConnectPostLoginManagerTest::generateStubUrl in Simple FB Connect 8.2

Same name and namespace in other branches
  1. 8.3 tests/src/Unit/SimpleFbConnectPostLoginManagerTest.php \Drupal\Tests\simple_fb_connect\Unit\SimpleFbConnectPostLoginManagerTest::generateStubUrl()

Helper function to generate stub Url objects.

Parameters

bool $external: Value to be returned from 'isExternal' method.

string $path: Value to be returned from 'toString' method.

3 calls to SimpleFbConnectPostLoginManagerTest::generateStubUrl()
SimpleFbConnectPostLoginManagerTest::testGetPostLoginPathWithInvalidQueryParameter in tests/src/Unit/SimpleFbConnectPostLoginManagerTest.php
Tests getPostLoginPath method with invalid query parameter.
SimpleFbConnectPostLoginManagerTest::testGetPostLoginPathWithValidQueryParameter in tests/src/Unit/SimpleFbConnectPostLoginManagerTest.php
Tests getPostLoginPath method with valid query parameter.
SimpleFbConnectPostLoginManagerTest::testPostLoginPathWithInvalidModulePath in tests/src/Unit/SimpleFbConnectPostLoginManagerTest.php
Tests getPostLoginPath method with fallback to 'user'.

File

tests/src/Unit/SimpleFbConnectPostLoginManagerTest.php, line 221
Contains Drupal\Tests\simple_fb_connect\Unit\SimpleFbConnectPostLoginManagerTest.

Class

SimpleFbConnectPostLoginManagerTest
@coversDefaultClass Drupal\simple_fb_connect\SimpleFbConnectPostLoginManager @group simple_fb_connect

Namespace

Drupal\Tests\simple_fb_connect\Unit

Code

protected function generateStubUrl($external, $path) {
  $url = $this
    ->getMockBuilder('Drupal\\Core\\Url')
    ->disableOriginalConstructor()
    ->setMethods(array(
    'isExternal',
    'toString',
  ))
    ->getMock();
  $url
    ->expects($this
    ->any())
    ->method('isExternal')
    ->willReturn($external);
  $url
    ->expects($this
    ->any())
    ->method('toString')
    ->willReturn($path);
  return $url;
}