class Fixtures

Same name in this branch
  1. 9 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures
Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Composer/Generator/Fixtures.php \Drupal\Tests\Composer\Generator\Fixtures
  2. 8.9.x core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures
  3. 10 core/tests/Drupal/Tests/Composer/Generator/Fixtures.php \Drupal\Tests\Composer\Generator\Fixtures
  4. 10 core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures
  5. 11.x core/tests/Drupal/Tests/Composer/Generator/Fixtures.php \Drupal\Tests\Composer\Generator\Fixtures
  6. 11.x core/tests/Drupal/Tests/Composer/Plugin/Scaffold/Fixtures.php \Drupal\Tests\Composer\Plugin\Scaffold\Fixtures

Convenience class for creating fixtures.

Hierarchy

  • class \Drupal\Tests\Composer\Generator\Fixtures

Expanded class hierarchy of Fixtures

4 string references to 'Fixtures'
FileCacheTest::testDelete in core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php
@covers ::delete
FileCacheTest::testGet in core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php
@covers ::get @covers ::__construct
FileCacheTest::testGetMultiple in core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php
@covers ::getMultiple
FileCacheTest::testSet in core/tests/Drupal/Tests/Component/FileCache/FileCacheTest.php
@covers ::set

File

core/tests/Drupal/Tests/Composer/Generator/Fixtures.php, line 10

Namespace

Drupal\Tests\Composer\Generator
View source
class Fixtures {
    
    /**
     * Generate a suitable DrupalCoreComposer fixture for testing.
     *
     * @return \Drupal\Composer\Generator\Util\DrupalCoreComposer
     *   DrupalCoreComposer fixture.
     */
    public function drupalCoreComposerFixture() {
        return new DrupalCoreComposer($this->composerJson(), $this->composerLock());
    }
    
    /**
     * Data for a composer.json fixture.
     *
     * @return array
     *   composer.json fixture data.
     */
    protected function composerJson() {
        return [
            'name' => 'drupal/project-fixture',
            'description' => 'A fixture for testing the metapackage generator.',
            'type' => 'project',
            'license' => 'GPL-2.0-or-later',
            'require' => [
                'composer/installers' => '^1.9',
                'php' => '>=7.0.8',
                'symfony/yaml' => '~3.4.5',
            ],
            'require-dev' => [
                'behat/mink' => '^1.8',
            ],
        ];
    }
    
    /**
     * Data for a composer.lock fixture.
     *
     * @return array
     *   composer.lock fixture data.
     */
    protected function composerLock() {
        return [
            '_readme' => [
                'This is a composer.lock fixture. It contains only a subset of a',
                'typical composer.lock file (just what is needed for testing).',
            ],
            'content-hash' => 'da9910627bab73a256b39ceda83d7167',
            'packages' => [
                [
                    'name' => "composer/installers",
                    'version' => 'v1.9.0',
                    'source' => [
                        'type' => 'git',
                        'url' => 'https://github.com/composer/installers.git',
                        'reference' => 'b93bcf0fa1fccb0b7d176b0967d969691cd74cca',
                    ],
                ],
                [
                    'name' => 'symfony/polyfill-ctype',
                    'version' => 'v1.12.0',
                    'source' => [
                        'type' => 'git',
                        'url' => 'https://github.com/symfony/polyfill-ctype.git',
                        'reference' => '550ebaac289296ce228a706d0867afc34687e3f4',
                    ],
                ],
                [
                    'name' => 'symfony/yaml',
                    'version' => 'v3.4.32',
                    'source' => [
                        'type' => 'git',
                        'url' => 'https://github.com/symfony/yaml.git',
                        'reference' => '768f817446da74a776a31eea335540f9dcb53942',
                    ],
                ],
            ],
            'packages-dev' => [
                [
                    'name' => 'behat/mink',
                    'version' => 'v1.8.0',
                    'source' => [
                        'type' => 'git',
                        'url' => 'https://github.com/minkphp/Mink.git',
                        'reference' => 'e1772aabb6b654464264a6cc72158c8b3409d8bc',
                    ],
                ],
                [
                    'name' => 'symfony/css-selector',
                    'version' => 'v4.3.5',
                    'source' => [
                        'type' => 'git',
                        'url' => 'https://github.com/symfony/css-selector.git',
                        'reference' => 'f4b3ff6a549d9ed28b2b0ecd1781bf67cf220ee9',
                    ],
                ],
            ],
        ];
    }

}

Members

Title Sort descending Modifiers Object type Summary
Fixtures::composerJson protected function Data for a composer.json fixture.
Fixtures::composerLock protected function Data for a composer.lock fixture.
Fixtures::drupalCoreComposerFixture public function Generate a suitable DrupalCoreComposer fixture for testing.

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