public function EntityManagerTest::testGetBulkResourceUrl in Acquia Content Hub 8
Test for getBulkResourceUrl() method.
@covers ::getBulkResourceUrl
File
- tests/
src/ Unit/ EntityManagerTest.php, line 333
Class
- EntityManagerTest
- PHPUnit for the EntityManager class.
Namespace
Drupal\Tests\acquia_contenthub\UnitCode
public function testGetBulkResourceUrl() {
$entity_manager = new EntityManager($this->loggerFactory, $this->configFactory, $this->clientManager, $this->contentHubEntitiesTracking, $this->entityTypeManager, $this->entityTypeBundleInfoManager, $this->kernel);
$container = $this
->createMock('Drupal\\Core\\DependencyInjection\\Container');
\Drupal::setContainer($container);
$bulk_route_name = 'acquia_contenthub.acquia_contenthub_bulk_cdf';
$url_options = [
'option1' => 'option_value_1',
];
$url_generator = $this
->createMock('Drupal\\Core\\Routing\\UrlGeneratorInterface');
$url_generator
->method('generateFromRoute')
->with($bulk_route_name, $url_options)
->willReturn('/node/1');
$container
->expects($this
->once())
->method('get')
->with('url_generator')
->willReturn($url_generator);
$this->settings
->expects($this
->once())
->method('get')
->with('rewrite_domain')
->willReturn('http://my-rewrite-domain.com');
$result_url = $entity_manager
->getBulkResourceUrl($url_options);
$expected_url = 'http://my-rewrite-domain.com/node/1';
$this
->assertEquals($expected_url, $result_url);
}