Skip to content

Commit

Permalink
Updated use of deprecated setMachineName().
Browse files Browse the repository at this point in the history
  • Loading branch information
joachim-n committed Sep 10, 2020
1 parent 5f9f948 commit 0a78c05
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions Definition/DataDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ public function setVariants(array $variants): self {
foreach ($variants as $variant_name => $variant) {
$properties = $variant->getProperties();
foreach ($properties as $name => $property) {
$property->setMachineName($name);
$property->setName($name);
}
}

Expand Down Expand Up @@ -283,7 +283,7 @@ public function setProperties(array $properties): self {

// Fill in machine names as a convenience.
foreach ($this->properties as $name => $property) {
$property->setMachineName($name);
$property->setName($name);
}

return $this;
Expand Down Expand Up @@ -412,7 +412,7 @@ public function addProperties(array $properties): self {

foreach ($properties as $name => $property) {
// Fill in machine names as a convenience.
$property->setMachineName($name);
$property->setName($name);

// Explicitly unset an existing property, so that the incoming order is
// used.
Expand Down
4 changes: 2 additions & 2 deletions Definition/VariantDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function setProperties(array $properties) {

// Fill in machine names as a convenience.
foreach ($this->properties as $name => $property) {
$property->setMachineName($name);
$property->setName($name);
}

return $this;
Expand All @@ -49,7 +49,7 @@ public function setProperties(array $properties) {
public function addProperties(array $properties): self {
foreach ($properties as $name => $property) {
// Fill in machine names as a convenience.
$property->setMachineName($name);
$property->setName($name);

$this->properties[$name] = $property;
}
Expand Down
14 changes: 7 additions & 7 deletions Test/src/DataItemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function testDataItemFactory() {
public function testGetParent() {
$complex_data = DataItemFactory::createFromDefinition(
DataDefinition::create('complex')
->setMachineName('root')
->setName('root')
->setProperties([
'one' => DataDefinition::create('complex')
->setMultiple(TRUE)
Expand Down Expand Up @@ -175,7 +175,7 @@ public function testItemAddress() {
// Data item with a root machine name.
$complex_data = DataItemFactory::createFromDefinition(
DataDefinition::create('complex')
->setMachineName('root')
->setName('root')
->setLabel('Root')
->setRequired(TRUE)
->setProperties([
Expand Down Expand Up @@ -416,7 +416,7 @@ public function testBubbling() {
*/
public function testDefaults() {
$definition = DataDefinition::create('complex')
->setMachineName('complex_data')
->setName('complex_data')
->setProperties([
'scalar_no_default' => DataDefinition::create('string'),
'scalar_default' => DataDefinition::create('string')
Expand Down Expand Up @@ -628,7 +628,7 @@ public function testOverridingDefaults() {
public function testDefaultExpressionAddressConversion() {
$complex_data = DataItemFactory::createFromDefinition(
DataDefinition::create('complex')
->setMachineName('root')
->setName('root')
->setProperties([
'one' => DataDefinition::create('complex')
->setMultiple(TRUE)
Expand Down Expand Up @@ -878,7 +878,7 @@ public function testValidators() {
$factory_class = \MutableTypedData\Fixtures\Factory\FactoryWithValidators::class;

$definition = DataDefinition::create('string')
->setMachineName('root')
->setName('root')
->setLabel('Colour string')
->setValidators('colour');

Expand Down Expand Up @@ -945,7 +945,7 @@ public function testUnset() {
*/
public function testImportExport() {
$definition = DataDefinition::create('complex')
->setMachineName('root')
->setName('root')
->setLabel('Label')
->setRequired(TRUE)
->setProperties([
Expand Down Expand Up @@ -1116,7 +1116,7 @@ public function testImportWithDefinitionUpdate() {
*/
public function testWalk() {
$definition = DataDefinition::create('complex')
->setMachineName('root')
->setName('root')
->setLabel('Label')
->setRequired(TRUE)
->setProperties([
Expand Down
2 changes: 1 addition & 1 deletion Test/src/PropertyDefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testDefineChildProperties() {
$this->assertEquals(['alpha', 'beta'], array_keys($definition->getProperties()));

$definition->addProperty(DataDefinition::create('string')
->setMachineName('gamma')
->setName('gamma')
->setLabel('Label')
->setRequired(TRUE)
);
Expand Down

0 comments on commit 0a78c05

Please sign in to comment.