function UpdateFetcherTest::setUp

Same name and namespace in other branches
  1. 9 core/modules/update/tests/src/Unit/UpdateFetcherTest.php \Drupal\Tests\update\Unit\UpdateFetcherTest::setUp()
  2. 8.9.x core/modules/update/tests/src/Unit/UpdateFetcherTest.php \Drupal\Tests\update\Unit\UpdateFetcherTest::setUp()
  3. 11.x core/modules/update/tests/src/Unit/UpdateFetcherTest.php \Drupal\Tests\update\Unit\UpdateFetcherTest::setUp()

Overrides UnitTestCase::setUp

File

core/modules/update/tests/src/Unit/UpdateFetcherTest.php, line 72

Class

UpdateFetcherTest
Tests update functionality unrelated to the database.

Namespace

Drupal\Tests\update\Unit

Code

protected function setUp() : void {
    parent::setUp();
    $this->mockConfigFactory = $this->getConfigFactoryStub([
        'update.settings' => [
            'fetch_url' => 'http://www.example.com',
        ],
    ]);
    $this->mockHttpClient = $this->createMock('\\GuzzleHttp\\ClientInterface');
    $settings = new Settings([]);
    $this->logger = new TestLogger();
    $this->updateFetcher = new UpdateFetcher($this->mockConfigFactory, $this->mockHttpClient, $settings, $this->logger);
    $this->testProject = [
        'name' => 'update_test',
        'project_type' => '',
        'info' => [
            'version' => '',
            'project status url' => 'https://www.example.com',
        ],
        'includes' => [
            'module1' => 'Module 1',
            'module2' => 'Module 2',
        ],
    ];
}

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