installConfig(['system']); $this->installEntitySchema('file'); $this->installSchema('file', ['file_usage']); $manager = $this->container->get('plugin.manager.filter'); $bag = new FilterPluginCollection($manager, []); $this->filters = $bag->getAll(); } /** * Tests the editor file reference filter. */ public function testEditorFileReferenceFilter() { $filter = $this->filters['editor_file_reference']; $test = function($input) use ($filter) { return $filter->process($input, 'und'); }; file_put_contents('public://llama.jpg', $this->randomMachineName()); $image = File::create(['uri' => 'public://llama.jpg']); $image->save(); $id = $image->id(); $uuid = $image->uuid(); $cache_tag = ['file:' . $id]; file_put_contents('public://alpaca.jpg', $this->randomMachineName()); $image_2 = File::create(['uri' => 'public://alpaca.jpg']); $image_2->save(); $id_2 = $image_2->id(); $uuid_2 = $image_2->uuid(); $cache_tag_2 = ['file:' . $id_2]; $this->pass('No data-entity-type and no data-entity-uuid attribute.'); $input = ''; $output = $test($input); $this->assertIdentical($input, $output->getProcessedText()); $this->pass('A non-file data-entity-type attribute value.'); $input = ''; $output = $test($input); $this->assertIdentical($input, $output->getProcessedText()); $this->pass('One data-entity-uuid attribute.'); $input = ''; $expected_output = ''; $output = $test($input); $this->assertIdentical($expected_output, $output->getProcessedText()); $this->assertEqual($cache_tag, $output->getCacheTags()); $this->pass('One data-entity-uuid attribute with odd capitalization.'); $input = ''; $expected_output = ''; $output = $test($input); $this->assertIdentical($expected_output, $output->getProcessedText()); $this->assertEqual($cache_tag, $output->getCacheTags()); $this->pass('One data-entity-uuid attribute on a non-image tag.'); $input = '