You are here

public function LibrariesAdminWebTest::testLibrariesReportOverview in Libraries API 7.2

Tests the libraries report at /admin/reports/libraries.

File

tests/LibrariesAdminWebTest.test, line 42
Contains LibrariesAdminWebTest.

Class

LibrariesAdminWebTest
Tests the administrative interface for libraries.

Code

public function testLibrariesReportOverview() {
  $this
    ->getWithPermissions(array(
    'access library reports',
  ), 'admin/reports/libraries');

  // Assert the page title and table titles show up.
  $this
    ->assertText('Libraries');
  $this
    ->assertRaw('<h2>Installed</h2>');
  $this
    ->assertRaw('<h2>Uninstalled</h2>');

  // Make sure the table headings show up.
  $this
    ->assertText('Name');
  $this
    ->assertText('Status');
  $this
    ->assertText('Version');
  $this
    ->assertText('Variants');
  $this
    ->assertText('Dependencies');
  $this
    ->assertText('Provider');
  $this
    ->assertText('Links');

  // Make sure that all the libraries are listed.
  $libraries = libraries_info();
  $this
    ->assertTrue($libraries);
  foreach ($libraries as $library) {
    $this
      ->assertText($library['name']);
    $this
      ->assertLinkByHref('admin/reports/libraries/' . $library['machine name']);
  }

  // Make sure that all possible error statuses are displayed.
  $this
    ->assertText('Not found');
  $this
    ->assertText('Not detected');
  $this
    ->assertText('Not supported');
  $this
    ->assertText('Missing dependency');
  $this
    ->assertText('Incompatible dependency');

  // Make sure that the providers are displayed.
  $this
    ->assertRaw('<em class="placeholder">Libraries test module</em> module');
  $this
    ->assertRaw('<em class="placeholder">Libraries test theme</em> theme');
  $this
    ->assertRaw('<em class="placeholder">example_info_file.libraries.info</em> info file');

  // Make sure that homepage and download links are displayed.
  $this
    ->assertLinkByHref('http://example.com');
  $this
    ->assertLinkByHref('http://example.com/download');
}