|
@@ 1476-1538 (lines=63) @@
|
| 1473 |
|
); |
| 1474 |
|
} |
| 1475 |
|
|
| 1476 |
|
public function testUpdateConfigFieldModelWithNoForce() |
| 1477 |
|
{ |
| 1478 |
|
$configId = new FieldConfigId('entity', self::ENTITY_CLASS, 'id', 'int'); |
| 1479 |
|
$metadata = $this->getEntityMetadata(self::ENTITY_CLASS); |
| 1480 |
|
$idFieldMetadata = $this->getFieldMetadata( |
| 1481 |
|
self::ENTITY_CLASS, |
| 1482 |
|
'id', |
| 1483 |
|
[ |
| 1484 |
|
'translatable1' => 'labelVal1', |
| 1485 |
|
'other1' => 'otherVal1', |
| 1486 |
|
'translatable2' => 'labelVal2', |
| 1487 |
|
'other2' => 'otherVal2', |
| 1488 |
|
] |
| 1489 |
|
); |
| 1490 |
|
$metadata->addPropertyMetadata($idFieldMetadata); |
| 1491 |
|
|
| 1492 |
|
$this->metadataFactory->expects($this->once()) |
| 1493 |
|
->method('getMetadataForClass') |
| 1494 |
|
->with(self::ENTITY_CLASS) |
| 1495 |
|
->willReturn($metadata); |
| 1496 |
|
$propertyConfigContainer = $this->getPropertyConfigContainerMock(); |
| 1497 |
|
$propertyConfigContainer->expects($this->once()) |
| 1498 |
|
->method('getDefaultValues') |
| 1499 |
|
->with(PropertyConfigContainer::TYPE_FIELD, 'int') |
| 1500 |
|
->willReturn(['translatable10' => 'labelVal10', 'other10' => 'otherVal10']); |
| 1501 |
|
$propertyConfigContainer->expects($this->once()) |
| 1502 |
|
->method('getTranslatableValues') |
| 1503 |
|
->with(PropertyConfigContainer::TYPE_FIELD) |
| 1504 |
|
->willReturn(['translatable1', 'translatable2', 'translatable10', 'auto_generated']); |
| 1505 |
|
$this->configProvider->expects($this->any()) |
| 1506 |
|
->method('getPropertyConfig') |
| 1507 |
|
->willReturn($propertyConfigContainer); |
| 1508 |
|
$config = $this->getConfig( |
| 1509 |
|
$configId, |
| 1510 |
|
[ |
| 1511 |
|
'translatable2' => 'labelVal2_old', |
| 1512 |
|
'other2' => 'otherVal2_old' |
| 1513 |
|
] |
| 1514 |
|
); |
| 1515 |
|
$this->configProvider->expects($this->once()) |
| 1516 |
|
->method('getConfig') |
| 1517 |
|
->with(self::ENTITY_CLASS) |
| 1518 |
|
->willReturn($config); |
| 1519 |
|
|
| 1520 |
|
$expectedConfig = $this->getConfig( |
| 1521 |
|
$configId, |
| 1522 |
|
[ |
| 1523 |
|
'translatable2' => 'labelVal2_old', |
| 1524 |
|
'other2' => 'otherVal2_old', |
| 1525 |
|
'translatable10' => 'labelVal10', |
| 1526 |
|
'other10' => 'otherVal10', |
| 1527 |
|
'translatable1' => 'labelVal1', |
| 1528 |
|
'other1' => 'otherVal1', |
| 1529 |
|
'auto_generated' => 'oro.entityconfig.tests.unit.fixture.demoentity.id.auto_generated' |
| 1530 |
|
] |
| 1531 |
|
); |
| 1532 |
|
|
| 1533 |
|
$this->configManager->updateConfigFieldModel(self::ENTITY_CLASS, 'id'); |
| 1534 |
|
$this->assertEquals( |
| 1535 |
|
$expectedConfig, |
| 1536 |
|
$this->configManager->getUpdateConfig()[0] |
| 1537 |
|
); |
| 1538 |
|
} |
| 1539 |
|
|
| 1540 |
|
public function testUpdateConfigFieldModelWithForce() |
| 1541 |
|
{ |
|
@@ 1540-1602 (lines=63) @@
|
| 1537 |
|
); |
| 1538 |
|
} |
| 1539 |
|
|
| 1540 |
|
public function testUpdateConfigFieldModelWithForce() |
| 1541 |
|
{ |
| 1542 |
|
$configId = new FieldConfigId('entity', self::ENTITY_CLASS, 'id', 'int'); |
| 1543 |
|
$metadata = $this->getEntityMetadata(self::ENTITY_CLASS); |
| 1544 |
|
$idFieldMetadata = $this->getFieldMetadata( |
| 1545 |
|
self::ENTITY_CLASS, |
| 1546 |
|
'id', |
| 1547 |
|
[ |
| 1548 |
|
'translatable1' => 'labelVal1', |
| 1549 |
|
'other1' => 'otherVal1', |
| 1550 |
|
'translatable2' => 'labelVal2', |
| 1551 |
|
'other2' => 'otherVal2', |
| 1552 |
|
] |
| 1553 |
|
); |
| 1554 |
|
$metadata->addPropertyMetadata($idFieldMetadata); |
| 1555 |
|
|
| 1556 |
|
$this->metadataFactory->expects($this->once()) |
| 1557 |
|
->method('getMetadataForClass') |
| 1558 |
|
->with(self::ENTITY_CLASS) |
| 1559 |
|
->willReturn($metadata); |
| 1560 |
|
$propertyConfigContainer = $this->getPropertyConfigContainerMock(); |
| 1561 |
|
$propertyConfigContainer->expects($this->once()) |
| 1562 |
|
->method('getDefaultValues') |
| 1563 |
|
->with(PropertyConfigContainer::TYPE_FIELD, 'int') |
| 1564 |
|
->willReturn(['translatable10' => 'labelVal10', 'other10' => 'otherVal10']); |
| 1565 |
|
$propertyConfigContainer->expects($this->once()) |
| 1566 |
|
->method('getTranslatableValues') |
| 1567 |
|
->with(PropertyConfigContainer::TYPE_FIELD) |
| 1568 |
|
->willReturn(['translatable1', 'translatable2', 'translatable10', 'auto_generated']); |
| 1569 |
|
$this->configProvider->expects($this->any()) |
| 1570 |
|
->method('getPropertyConfig') |
| 1571 |
|
->willReturn($propertyConfigContainer); |
| 1572 |
|
$config = $this->getConfig( |
| 1573 |
|
$configId, |
| 1574 |
|
[ |
| 1575 |
|
'translatable2' => 'labelVal2_old', |
| 1576 |
|
'other2' => 'otherVal2_old' |
| 1577 |
|
] |
| 1578 |
|
); |
| 1579 |
|
$this->configProvider->expects($this->once()) |
| 1580 |
|
->method('getConfig') |
| 1581 |
|
->with(self::ENTITY_CLASS) |
| 1582 |
|
->willReturn($config); |
| 1583 |
|
|
| 1584 |
|
$expectedConfig = $this->getConfig( |
| 1585 |
|
$configId, |
| 1586 |
|
[ |
| 1587 |
|
'translatable2' => 'labelVal2', |
| 1588 |
|
'other2' => 'otherVal2', |
| 1589 |
|
'translatable10' => 'labelVal10', |
| 1590 |
|
'other10' => 'otherVal10', |
| 1591 |
|
'translatable1' => 'labelVal1', |
| 1592 |
|
'other1' => 'otherVal1', |
| 1593 |
|
'auto_generated' => 'oro.entityconfig.tests.unit.fixture.demoentity.id.auto_generated' |
| 1594 |
|
] |
| 1595 |
|
); |
| 1596 |
|
|
| 1597 |
|
$this->configManager->updateConfigFieldModel(self::ENTITY_CLASS, 'id', true); |
| 1598 |
|
$this->assertEquals( |
| 1599 |
|
$expectedConfig, |
| 1600 |
|
$this->configManager->getUpdateConfig()[0] |
| 1601 |
|
); |
| 1602 |
|
} |
| 1603 |
|
|
| 1604 |
|
public function testUpdateConfigFieldModelWithForceForCustomField() |
| 1605 |
|
{ |