'Libraries administration', 'description' => 'Tests the administrative interface for libraries.', 'group' => 'Libraries API', ); } /** * Tests the libraries report at /admin/reports/libraries. */ 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('

Installed

'); $this->assertRaw('

Uninstalled

'); // 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('Libraries test module module'); $this->assertRaw('Libraries test theme theme'); $this->assertRaw('example_info_file.libraries.info info file'); // Make sure that homepage and download links are displayed. $this->assertLinkByHref('http://example.com'); $this->assertLinkByHref('http://example.com/download'); } /** * Tests the libraries report for an installed library. */ public function testLibrariesReportInstalled() { $this->getWithPermissions(array('access library reports'), 'admin/reports/libraries/example_files'); $this->assertRaw('Status report for library Example files'); $this->assertRaw('The Example files library is installed correctly.'); // Check that the information in the status report is displayed. $this->assertText('Example files'); $this->assertText('example_files'); $this->assertRaw('Libraries test module module'); $this->assertText(drupal_get_path('module', 'libraries') . '/tests/libraries/example'); $this->assertText('1'); } /** * Tests the libraries report for a missing library. */ public function testLibrariesReportMissing() { $this->getWithPermissions(array('access library reports'), 'admin/reports/libraries/example_missing'); $this->assertRaw('Status report for library Example missing'); $this->assertRaw('The Example missing library could not be found.'); // Check that the download link is being displayed. $this->assertLinkByHref('http://example.com/download'); } /** * Tests the libraries report for a missing library. */ public function testLibrariesReportNotDetected() { $this->getWithPermissions(array('access library reports'), 'admin/reports/libraries/example_undetected_version'); $this->assertRaw('Status report for library Example undetected version'); $this->assertRaw('The version of the Example undetected version library could not be detected.'); } /** * Tests the libraries report for a missing library. */ public function testLibrariesReportNotSupported() { $this->getWithPermissions(array('access library reports'), 'admin/reports/libraries/example_unsupported_version'); $this->assertRaw('Status report for library Example unsupported version'); $this->assertRaw('The installed version 1 of the Example unsupported version library is not supported.'); // Check that the download link is being displayed. $this->assertLinkByHref('http://example.com/download'); } }