function UpdateCalculateProjectDataTest::testProjectStatus

Same name and namespace in other branches
  1. 11.x core/modules/update/tests/src/Kernel/UpdateCalculateProjectDataTest.php \Drupal\Tests\update\Kernel\UpdateCalculateProjectDataTest::testProjectStatus()
  2. 10 core/modules/update/tests/src/Kernel/UpdateCalculateProjectDataTest.php \Drupal\Tests\update\Kernel\UpdateCalculateProjectDataTest::testProjectStatus()

Tests the project_status of the project.

Attributes

#[DataProvider('providerProjectStatus')]

File

core/modules/update/tests/src/Kernel/UpdateCalculateProjectDataTest.php, line 119

Class

UpdateCalculateProjectDataTest
Test the values set in \Drupal\update\UpdateManagerInterface::calculateProjectData().

Namespace

Drupal\Tests\update\Kernel

Code

public function testProjectStatus(string $fixture, int $status, string $label, string $expected_error_message) : void {
  $this->setReleaseMetadata(__DIR__ . $fixture);
  $available = \Drupal::service(UpdateManagerInterface::class)->getAvailable(TRUE);
  $project_data = \Drupal::service(UpdateManagerInterface::class)->calculateProjectData($available);
  $this->assertArrayHasKey('status', $project_data['drupal']);
  $this->assertEquals($status, $project_data['drupal']['status']);
  $this->assertArrayHasKey('extra', $project_data['drupal']);
  $this->assertEquals($label, $project_data['drupal']['extra']['0']['label']);
  $this->assertEquals($expected_error_message, $project_data['drupal']['extra']['0']['data']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.