public function SimpleFbConnectPostLoginManagerTest::testPostLoginPathWithInvalidModulePath in Simple FB Connect 8.3
Same name and namespace in other branches
- 8.2 tests/src/Unit/SimpleFbConnectPostLoginManagerTest.php \Drupal\Tests\simple_fb_connect\Unit\SimpleFbConnectPostLoginManagerTest::testPostLoginPathWithInvalidModulePath()
Tests getPostLoginPath method with fallback to 'user'.
@covers ::getPostLoginPath @covers ::validateInternalPath
File
- tests/
src/ Unit/ SimpleFbConnectPostLoginManagerTest.php, line 151
Class
- SimpleFbConnectPostLoginManagerTest
- @coversDefaultClass Drupal\simple_fb_connect\SimpleFbConnectPostLoginManager @group simple_fb_connect
Namespace
Drupal\Tests\simple_fb_connect\UnitCode
public function testPostLoginPathWithInvalidModulePath() {
// 1. Path from query parameter.
$query_path = 'http://www.example.com';
$this->persistentDataHandler
->expects($this
->once())
->method('get')
->with('post_login_path')
->willReturn($query_path);
$query_url = $this
->generateStubUrl(TRUE, $query_path);
// 2. Module settings has invalid path so pathValidator will return FALSE
// instead of an URL object.
$module_url = FALSE;
// 3. Fallback to 'user'.
$fallback_path = 'user';
$fallback_url = $this
->generateStubUrl(FALSE, $fallback_path);
$this->pathValidator
->expects($this
->any())
->method('getUrlIfValid')
->will($this
->onConsecutiveCalls($query_url, $module_url, $fallback_url));
$this
->assertEquals($fallback_path, $this->postLoginManager
->getPostLoginPath());
}