You are here

function UpdateContribTest::testUpdateContribBasic in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/update/src/Tests/UpdateContribTest.php \Drupal\update\Tests\UpdateContribTest::testUpdateContribBasic()

Tests the basic functionality of a contrib module on the status report.

File

core/modules/update/src/Tests/UpdateContribTest.php, line 68
Contains \Drupal\update\Tests\UpdateContribTest.

Class

UpdateContribTest
Tests how the Update Manager module handles contributed modules and themes in a series of functional tests using mock XML data.

Namespace

Drupal\update\Tests

Code

function testUpdateContribBasic() {
  $project_link = \Drupal::l(t('AAA Update test'), Url::fromUri('http://example.com/project/aaa_update_test'));
  $system_info = array(
    '#all' => array(
      'version' => '8.0.0',
    ),
    'aaa_update_test' => array(
      'project' => 'aaa_update_test',
      'version' => '8.x-1.0',
      'hidden' => FALSE,
    ),
  );
  $this
    ->config('update_test.settings')
    ->set('system_info', $system_info)
    ->save();
  $this
    ->refreshUpdateStatus(array(
    'drupal' => '0.0',
    'aaa_update_test' => '1_0',
  ));
  $this
    ->standardTests();
  $this
    ->assertText(t('Up to date'));
  $this
    ->assertRaw('<h3>' . t('Modules') . '</h3>');
  $this
    ->assertNoText(t('Update available'));
  $this
    ->assertRaw($project_link, 'Link to aaa_update_test project appears.');

  // Since aaa_update_test is installed the fact it is hidden and in the
  // Testing package means it should not appear.
  $system_info['aaa_update_test']['hidden'] = TRUE;
  $this
    ->config('update_test.settings')
    ->set('system_info', $system_info)
    ->save();
  $this
    ->refreshUpdateStatus(array(
    'drupal' => '0.0',
    'aaa_update_test' => '1_0',
  ));
  $this
    ->assertNoRaw($project_link, 'Link to aaa_update_test project does not appear.');

  // A hidden and installed project not in the Testing package should appear.
  $system_info['aaa_update_test']['package'] = 'aaa_update_test';
  $this
    ->config('update_test.settings')
    ->set('system_info', $system_info)
    ->save();
  $this
    ->refreshUpdateStatus(array(
    'drupal' => '0.0',
    'aaa_update_test' => '1_0',
  ));
  $this
    ->assertRaw($project_link, 'Link to aaa_update_test project appears.');
}