Skip to content

Commit 17936fb

Browse files
committed
ACP2E-3453: Unable to Update Scheduled Update When Using Unique Custom Category Attribute
1 parent a818b03 commit 17936fb

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

app/code/Magento/Eav/Model/Entity/Attribute/UniqueValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
/**
3-
* Copyright © Magento, Inc. All rights reserved.
4-
* See COPYING.txt for license details.
3+
* Copyright 2018 Adobe
4+
* All Rights Reserved.
55
*/
66
namespace Magento\Eav\Model\Entity\Attribute;
77

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
/**
3+
* Copyright 2024 Adobe
4+
* All Rights Reserved.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Eav\Test\Unit\Model\Entity\Attribute;
9+
10+
use PHPUnit\Framework\TestCase;
11+
use Magento\Eav\Model\Entity\Attribute\UniqueValidator;
12+
use Magento\Framework\DataObject;
13+
use Magento\Eav\Model\Entity\AbstractEntity;
14+
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
15+
16+
class UniqueValidatorTest extends TestCase
17+
{
18+
/**
19+
* @var UniqueValidator
20+
*/
21+
private $uniqueValidator;
22+
23+
protected function setUp(): void
24+
{
25+
$this->uniqueValidator = new UniqueValidator();
26+
}
27+
28+
public function testValidate()
29+
{
30+
$attribute = $this->createMock(AbstractAttribute::class);
31+
$object = $this->createMock(DataObject::class);
32+
$entity = $this->createMock(AbstractEntity::class);
33+
$entityLinkField = 'entityLinkField';
34+
$entityIds = [1, 2, 3];
35+
36+
$object->expects($this->once())
37+
->method('getData')
38+
->with($entityLinkField)
39+
->willReturn(2);
40+
41+
$this->assertTrue($this->uniqueValidator->validate($attribute, $object, $entity, $entityLinkField, $entityIds));
42+
}
43+
}

0 commit comments

Comments
 (0)