class SimpleFbConnectFbManagerTest in Simple FB Connect 8.3
@coversDefaultClass Drupal\simple_fb_connect\SimpleFbConnectFbManager @group simple_fb_connect
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\simple_fb_connect\Unit\SimpleFbConnectFbManagerTest
Expanded class hierarchy of SimpleFbConnectFbManagerTest
File
- tests/
src/ Unit/ SimpleFbConnectFbManagerTest.php, line 12
Namespace
Drupal\Tests\simple_fb_connect\UnitView source
class SimpleFbConnectFbManagerTest extends UnitTestCase {
protected $loggerFactory;
protected $eventDispatcher;
protected $entityFieldManager;
protected $urlGenerator;
protected $persistentDataHandler;
protected $facebook;
protected $fbManager;
/**
* {@inheritdoc}
*/
protected function setUp() {
parent::setUp();
$this->loggerFactory = $this
->getMock('Drupal\\Core\\Logger\\LoggerChannelFactoryInterface');
$this->eventDispatcher = $this
->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
$this->entityFieldManager = $this
->getMock('Drupal\\Core\\Entity\\EntityFieldManagerInterface');
$this->urlGenerator = $this
->getMock('Drupal\\Core\\Routing\\UrlGeneratorInterface');
$this->persistentDataHandler = $this
->getMockBuilder('Drupal\\simple_fb_connect\\SimpleFbConnectPersistentDataHandler')
->disableOriginalConstructor()
->getMock();
$this->fbManager = new SimpleFbConnectFbManager($this->loggerFactory, $this->eventDispatcher, $this->entityFieldManager, $this->urlGenerator, $this->persistentDataHandler);
$this->facebook = $this
->getMockBuilder('Facebook\\Facebook')
->disableOriginalConstructor()
->getMock();
$this->fbManager
->setFacebookService($this->facebook);
}
/**
* Tests getFbReRequestUrl method.
*
* @covers ::getFbReRequestUrl
*/
public function testGetFbReRequestUrl() {
$login_helper = $this
->getMockBuilder('Facebook\\Helpers\\FacebookRedirectLoginHelper')
->disableOriginalConstructor()
->getMock();
$login_helper
->expects($this
->once())
->method('getReRequestUrl')
->willReturn('https://www.facebook.com/rerequest-url');
$this->facebook
->expects($this
->once())
->method('getRedirectLoginHelper')
->willReturn($login_helper);
$this->urlGenerator
->expects($this
->once())
->method('generateFromRoute')
->willReturn('http://www.example.com/user/simple-fb-connect/return');
$this
->assertSame($this->fbManager
->getFbReRequestUrl(), 'https://www.facebook.com/rerequest-url');
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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. | |
SimpleFbConnectFbManagerTest:: |
protected | property | ||
SimpleFbConnectFbManagerTest:: |
protected | property | ||
SimpleFbConnectFbManagerTest:: |
protected | property | ||
SimpleFbConnectFbManagerTest:: |
protected | property | ||
SimpleFbConnectFbManagerTest:: |
protected | property | ||
SimpleFbConnectFbManagerTest:: |
protected | property | ||
SimpleFbConnectFbManagerTest:: |
protected | property | ||
SimpleFbConnectFbManagerTest:: |
protected | function |
Overrides UnitTestCase:: |
|
SimpleFbConnectFbManagerTest:: |
public | function | Tests getFbReRequestUrl method. | |
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. |