🇮🇳India @Ankita31

Account created on 7 January 2015, over 10 years ago
#

Recent comments

🇮🇳India Ankita31

I am also facing the same error, on update DB command:
[error] Search API Autocomplete requires this module and version. Currently using
Search API version
(Currently using Unresolved dependency Search API (Version >= 1.37 required)
)

🇮🇳India Ankita31

namespace Drupal\Tests\drupal_product_comparison\Kernel;

use Drupal\file\Entity\File;
use Drupal\image\Entity\ImageStyle;
use Drupal\media\Entity\Media;
use Drupal\drupal_products\Entity\Product;
use Drupal\taxonomy\Entity\Term;
use Drupal\Tests\drupal_products\Kernel\drupalProductTestBase;

/**
* Test product normalization.
*
* @group drupal_product_comparison
*/
class ProductNormalizerTest extends drupalProductTestBase {

/**
* {@inheritdoc}
*/
public static $modules = [
'drupal_product_comparison',
'drupal_new_content',
'serialization',
];

/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();

$this->installEntitySchema('drupal_product');
$this->installEntitySchema('taxonomy_term');
$this->installEntitySchema('file');
$this->installEntitySchema('media');

$this->installSchema('file', ['file_usage']);

ImageStyle::create([
'name' => 'comparison_panel_thumb',
'label' => 'Compare thumb',
])->save();
}

/**
* Test the product normalizer.
*/
public function testNormalizer() {
$brand = Term::create([
'vid' => 'brand',
'name' => 'Test Brand',
]);
$file = File::create([
'uri' => 'public://test.jpg',
]);
$file->save();
$media = Media::create([
'bundle' => 'image',
'field_media_image' => [
'entity' => $file,
],
]);
$media->save();

ImageStyle::create([
'name' => 'compare_thumb',
'label' => 'Compare thumb',
])->save();

$product = Product::create([
'product_type' => 'test_type',
'product_name' => 'Product 5',
'brand' => ['entity' => $brand],
'product_images' => ['entity' => $media],
]);
$product->save();

$url = ImageStyle::load('comparison_panel_thumb')->buildUrl($product->product_images[0]->entity->field_media_image->entity->getFileUri());
$this->assertStringContainsString('files/styles/comparison_panel_thumb', $url);
$this->assertStringContainsString('test.jpg', $url);

$json = \json_encode([
'id' => 1,
'category' => 'Test Type',
'title' => 'Product 5',
'type' => 'Test Brand',
'image' => $url,
'new' => FALSE,
]);
$this->assertEquals($json, $this->container->get('serializer')->serialize($product, 'json'));
}

}
this is the code I pasted above and the path_alias module also enabled. This exaxtly same test passed on Drupal 9 but it throws the memtioned error on D10

Production build 0.71.5 2024