You are here

public function AcquiadamServiceTest::testGetFlattenedFolderList in Media: Acquia DAM 8

Tests that flattened folder output matches what is expected.

File

tests/src/Unit/AcquiadamServiceTest.php, line 87

Class

AcquiadamServiceTest
Acquia DAM REST extension tests.

Namespace

Drupal\Tests\media_acquiadam\Unit

Code

public function testGetFlattenedFolderList() {

  // Test that the top level flattening works as expected.
  $folders = $this->acquiaDamClient
    ->getFlattenedFolderList();
  $this
    ->assertArrayEquals($this
    ->getFlattenedTopLevelFoldersData(), $folders);

  // Test that a parent item gets its proper child items.
  $folders = $this->acquiaDamClient
    ->getFlattenedFolderList(90672);
  $this
    ->assertArrayEquals([
    90673 => 'Slideshows',
    90674 => 'Ad Ideas',
  ], $folders);

  // Test that a parent item gets its proper child items.
  $folders = $this->acquiaDamClient
    ->getFlattenedFolderList(90786);
  $this
    ->assertArrayEquals([
    90787 => 'Spreadsheets',
    90788 => 'Logos',
  ], $folders);

  // Test that items with no children reflect that.
  $folders = $this->acquiaDamClient
    ->getFlattenedFolderList(90832);
  $this
    ->assertArrayEquals([], $folders);

  // Test that child items with no subchildren reflect that.
  $folders = $this->acquiaDamClient
    ->getFlattenedFolderList(90673);
  $this
    ->assertArrayEquals([], $folders);
}