Commit 9b2f974f authored by catch's avatar catch

Issue #2641590 by ashhishhh, Mac_Weber: Replace deprecated usage of ...

Issue #2641590 by ashhishhh, Mac_Weber: Replace deprecated usage of  entity_create('image_style') with a direct call to ImageStyle::create()
parent 32207411
......@@ -282,7 +282,7 @@ function testStyleReplacement() {
// Create a new style.
$style_name = strtolower($this->randomMachineName(10));
$style_label = $this->randomString();
$style = entity_create('image_style', array('name' => $style_name, 'label' => $style_label));
$style = ImageStyle::create(array('name' => $style_name, 'label' => $style_label));
$style->save();
$style_path = 'admin/config/media/image-styles/manage/';
......@@ -387,7 +387,7 @@ public function testFlushUserInterface() {
// Create a new style.
$style_name = strtolower($this->randomMachineName(10));
$style = entity_create('image_style', array('name' => $style_name, 'label' => $this->randomString()));
$style = ImageStyle::create(array('name' => $style_name, 'label' => $this->randomString()));
$style->save();
// Create an image to make sure it gets flushed.
......@@ -417,7 +417,7 @@ function testConfigImport() {
// Create a new style.
$style_name = strtolower($this->randomMachineName(10));
$style_label = $this->randomString();
$style = entity_create('image_style', array('name' => $style_name, 'label' => $style_label));
$style = ImageStyle::create(array('name' => $style_name, 'label' => $style_label));
$style->save();
// Create an image field that uses the new style.
......@@ -458,7 +458,7 @@ function testConfigImport() {
* Tests access for the image style listing.
*/
public function testImageStyleAccess() {
$style = entity_create('image_style', array('name' => 'style_foo', 'label' => $this->randomString()));
$style = ImageStyle::create(array('name' => 'style_foo', 'label' => $this->randomString()));
$style->save();
$this->drupalGet('admin/config/media/image-styles');
......
......@@ -38,7 +38,7 @@ function testImageDimensions() {
// Create a style.
/** @var $style \Drupal\image\ImageStyleInterface */
$style = entity_create('image_style', array('name' => 'test', 'label' => 'Test'));
$style = ImageStyle::create(array('name' => 'test', 'label' => 'Test'));
$style->save();
$generated_uri = 'public://styles/test/public/'. \Drupal::service('file_system')->basename($original_uri);
$url = $style->buildUrl($original_uri);
......
......@@ -7,6 +7,7 @@
namespace Drupal\image\Tests;
use Drupal\image\Entity\ImageStyle;
use Drupal\simpletest\WebTestBase;
/**
......@@ -31,7 +32,7 @@ class ImageStylesPathAndUrlTest extends WebTestBase {
protected function setUp() {
parent::setUp();
$this->style = entity_create('image_style', array('name' => 'style_foo', 'label' => $this->randomString()));
$this->style = ImageStyle::create(array('name' => 'style_foo', 'label' => $this->randomString()));
$this->style->save();
}
......
......@@ -9,6 +9,7 @@
use Drupal\Core\Field\FieldStorageDefinitionInterface;
use Drupal\Core\Url;
use Drupal\image\Entity\ImageStyle;
use Drupal\simpletest\WebTestBase;
/**
......@@ -72,7 +73,7 @@ function testImageFormatterTheme() {
$original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
// Create a style.
$style = entity_create('image_style', array('name' => 'test', 'label' => 'Test'));
$style = ImageStyle::create(array('name' => 'test', 'label' => 'Test'));
$style->save();
$url = $style->buildUrl($original_uri);
......@@ -134,7 +135,7 @@ function testImageStyleTheme() {
$original_uri = file_unmanaged_copy($file->uri, 'public://', FILE_EXISTS_RENAME);
// Create a style.
$style = entity_create('image_style', array('name' => 'image_test', 'label' => 'Test'));
$style = ImageStyle::create(array('name' => 'image_test', 'label' => 'Test'));
$style->save();
$url = $style->buildUrl($original_uri);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment