3 namespace Drupal\Tests\crop\Kernel;
5 use Drupal\crop\EntityProviderNotFoundException;
8 * Tests entity provider plugins.
12 class CropEntityProvidersTest extends CropUnitTestBase {
19 public static $modules = ['crop', 'file', 'image', 'user', 'system'];
24 protected function setUp() {
27 $this->container->get('entity.manager')
28 ->onEntityTypeCreate($this->container->get('entity.manager')->getDefinition('file'));
32 * Tests file provider plugin.
34 public function testCropEffect() {
35 $file = $this->getTestFile();
40 'type' => $this->cropType->id(),
41 'entity_id' => $file->id(),
42 'entity_type' => 'file',
43 'uri' => $file->getFileUri(),
49 /** @var \Drupal\crop\CropInterface $crop */
50 $crop = $this->container->get('entity.manager')->getStorage('crop')->create($values);
54 $provider = $crop->provider();
55 $this->assertTrue(TRUE, 'File entity provider plugin was found.');
57 catch (EntityProviderNotFoundException $e) {
58 $this->assertTrue(FALSE, 'File entity provider plugin was found.');
61 $this->assertEquals($provider->uri($file), $file->getFileUri(), 'File provider plugin returned correct URI.');