comparison core/modules/image/tests/src/Kernel/ImageItemTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
65 'bundle' => 'entity_test', 65 'bundle' => 'entity_test',
66 'settings' => [ 66 'settings' => [
67 'file_extensions' => 'jpg', 67 'file_extensions' => 'jpg',
68 ], 68 ],
69 ])->save(); 69 ])->save();
70 file_unmanaged_copy($this->root . '/core/misc/druplicon.png', 'public://example.jpg'); 70 \Drupal::service('file_system')->copy($this->root . '/core/misc/druplicon.png', 'public://example.jpg');
71 $this->image = File::create([ 71 $this->image = File::create([
72 'uri' => 'public://example.jpg', 72 'uri' => 'public://example.jpg',
73 ]); 73 ]);
74 $this->image->save(); 74 $this->image->save();
75 $this->imageFactory = $this->container->get('image.factory'); 75 $this->imageFactory = $this->container->get('image.factory');
98 $this->assertEqual($entity->image_test->height, $image->getHeight()); 98 $this->assertEqual($entity->image_test->height, $image->getHeight());
99 $this->assertEqual($entity->image_test->entity->id(), $this->image->id()); 99 $this->assertEqual($entity->image_test->entity->id(), $this->image->id());
100 $this->assertEqual($entity->image_test->entity->uuid(), $this->image->uuid()); 100 $this->assertEqual($entity->image_test->entity->uuid(), $this->image->uuid());
101 101
102 // Make sure the computed entity reflects updates to the referenced file. 102 // Make sure the computed entity reflects updates to the referenced file.
103 file_unmanaged_copy($this->root . '/core/misc/druplicon.png', 'public://example-2.jpg'); 103 \Drupal::service('file_system')->copy($this->root . '/core/misc/druplicon.png', 'public://example-2.jpg');
104 $image2 = File::create([ 104 $image2 = File::create([
105 'uri' => 'public://example-2.jpg', 105 'uri' => 'public://example-2.jpg',
106 ]); 106 ]);
107 $image2->save(); 107 $image2->save();
108 108