Skip to content

Commit

Permalink
upgrade faker (fixes tddwizard#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
lfolco committed Dec 13, 2022
1 parent e9c92c1 commit 1c390bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"magento/module-payment": "^100.3",
"magento/module-quote": "^101.1",
"magento/module-sales": "^102.0|^103.0",
"fakerphp/faker": "^1.9.1"
"fakerphp/faker": "^1.14.0"
},
"require-dev": {
"ext-json": "*",
Expand All @@ -52,5 +52,11 @@
"phpro/grumphp": "^0.19.0",
"phpstan/phpstan": "^0.12.0",
"squizlabs/php_codesniffer": "^3.3.1"
},
"config": {
"allow-plugins": {
"magento/composer-dependency-version-audit-plugin": true,
"phpro/grumphp": true
}
}
}
18 changes: 9 additions & 9 deletions src/Customer/AddressBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,24 +191,24 @@ private static function prepareFakeAddress(
$countryCode = substr($locale, -2);

try {
$region = $faker->province;
$region = $faker->province();
} catch (InvalidArgumentException $exception) {
$region = $faker->state;
$region = $faker->state();
}

$regionId = $objectManager->create(Region::class)->loadByName($region, $countryCode)->getId();

/** @var AddressInterface $address */
$address = $objectManager->create(AddressInterface::class);
$address
->setTelephone($faker->phoneNumber)
->setPostcode($faker->postcode)
->setTelephone($faker->phoneNumber())
->setPostcode($faker->postcode())
->setCountryId($countryCode)
->setCity($faker->city)
->setCompany($faker->company)
->setStreet([$faker->streetAddress])
->setLastname($faker->lastName)
->setFirstname($faker->firstName)
->setCity($faker->city())
->setCompany($faker->company())
->setStreet([$faker->streetAddress()])
->setLastname($faker->lastName())
->setFirstname($faker->firstName())
->setRegionId($regionId);

return $address;
Expand Down

0 comments on commit 1c390bc

Please sign in to comment.