You are here

protected function AssetDataTest::setUp in Media: Acquia DAM 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/AssetDataTest.php, line 49

Class

AssetDataTest
Tests to validate that the asset data service works as expected.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

protected function setUp() {
  parent::setUp();
  $connection = $this
    ->getMockBuilder(Connection::class)
    ->disableOriginalConstructor()
    ->getMock();
  $asset_data = $this
    ->getMockBuilder(AssetData::class)
    ->disableOriginalConstructor()
    ->setMethods([
    'get',
    'set',
  ])
    ->getMock();
  $asset_data
    ->method('get')
    ->willReturnMap([
    [
      3455969,
      'version',
      3,
    ],
    [
      3455970,
      'version',
      4,
    ],
  ]);
  $this->acquiaAssetData = $asset_data;
  $this->container = new ContainerBuilder();
  $this->container
    ->set('database', $connection);
  \Drupal::setContainer($this->container);
}