You are here

public function UpdateManagerTest::testGetAvailable in Lightning Core 8.5

Same name and namespace in other branches
  1. 8 tests/src/Kernel/UpdateManagerTest.php \Drupal\Tests\lightning_core\Kernel\UpdateManagerTest::testGetAvailable()
  2. 8.2 tests/src/Kernel/UpdateManagerTest.php \Drupal\Tests\lightning_core\Kernel\UpdateManagerTest::testGetAvailable()
  3. 8.3 tests/src/Kernel/UpdateManagerTest.php \Drupal\Tests\lightning_core\Kernel\UpdateManagerTest::testGetAvailable()
  4. 8.4 tests/src/Kernel/UpdateManagerTest.php \Drupal\Tests\lightning_core\Kernel\UpdateManagerTest::testGetAvailable()

@covers ::getAvailable

File

tests/src/Kernel/UpdateManagerTest.php, line 61

Class

UpdateManagerTest
@coversDefaultClass \Drupal\lightning_core\UpdateManager

Namespace

Drupal\Tests\lightning_core\Kernel

Code

public function testGetAvailable() {
  $discovery = $this
    ->prophesize('\\Drupal\\Component\\Plugin\\Discovery\\DiscoveryInterface');
  $discovery
    ->getDefinitions()
    ->willReturn([
    'fubar:1.2.1' => [
      'id' => '1.2.1',
      'provider' => 'fubar',
    ],
    'fubar:1.2.2' => [
      'id' => '1.2.2',
      'provider' => 'fubar',
    ],
    'fubar:1.2.3' => [
      'id' => '1.2.3',
      'provider' => 'fubar',
    ],
  ]);
  $this->updateManager->discovery = $discovery
    ->reveal();
  $this->container
    ->get('config.factory')
    ->getEditable(UpdateManager::CONFIG_NAME)
    ->set('fubar', '1.2.2')
    ->save();
  $definitions = $this->updateManager
    ->getAvailable();
  $this
    ->assertCount(1, $definitions);
  $this
    ->assertArrayHasKey('fubar:1.2.3', $definitions);
}