public function TwigTweakTest::setUp in Twig Tweak 3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/TwigTweakTest.php \Drupal\Tests\twig_tweak\Functional\TwigTweakTest::setUp()
- 8 tests/src/Functional/TwigTweakTest.php \Drupal\Tests\twig_tweak\Functional\TwigTweakTest::setUp()
- 3.1.x tests/src/Functional/TwigTweakTest.php \Drupal\Tests\twig_tweak\Functional\TwigTweakTest::setUp()
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ TwigTweakTest.php, line 48
Class
- TwigTweakTest
- A test for Twig extension.
Namespace
Drupal\Tests\twig_tweak\FunctionalCode
public function setUp() : void {
parent::setUp();
$test_files = $this
->getTestFiles('image');
$image_file = File::create([
'uri' => $test_files[0]->uri,
'uuid' => 'b2c22b6f-7bf8-4da4-9de5-316e93487518',
'status' => FILE_STATUS_PERMANENT,
]);
$image_file
->save();
$media_file = File::create([
'uri' => $test_files[8]->uri,
'uuid' => '5dd794d0-cb75-4130-9296-838aebc1fe74',
'status' => FILE_STATUS_PERMANENT,
]);
$media_file
->save();
$media = Media::create([
'bundle' => 'image',
'name' => 'Image 1',
'field_media_image' => [
'target_id' => $media_file
->id(),
],
]);
$media
->save();
$node_values = [
'title' => 'Alpha',
'uuid' => 'ad1b902a-344f-41d1-8c61-a69f0366dbfa',
'field_image' => [
'target_id' => $image_file
->id(),
'alt' => 'Alt text',
'title' => 'Title',
],
'field_media' => [
'target_id' => $media
->id(),
],
];
$this
->createNode($node_values);
$this
->createNode([
'title' => 'Beta',
]);
$this
->createNode([
'title' => 'Gamma',
]);
ResponsiveImageStyle::create([
'id' => 'example',
'label' => 'Example',
'breakpoint_group' => 'responsive_image',
])
->save();
// Setup Russian language.
ConfigurableLanguage::createFromLangcode('ru')
->save();
}