Skip to content

Commit

Permalink
VACMS-19227: Refactors test to includ getDefinitions
Browse files Browse the repository at this point in the history
  • Loading branch information
omahane committed Dec 19, 2024
1 parent 659abe4 commit 51bf2a5
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,18 @@ public function testOnSubdivisions() {
/** @var \Prophecy\Prophecy\ObjectProphecy|\Drupal\address\Event\SubdivisionsEvent $event */
$event = $this->prophesize(SubdivisionsEvent::class);

// Mock the getParents method to return ['US'].
$event->getParents()->willReturn(['US']);
// Configure the prophecy to return specific values for getDefinitions().
$definitions = [
'subdivisions' => [
'CA' => [
'code' => 'CA',
'name' => 'California',
'country_code' => 'US',
'id' => 'CA',
],
],
];
$event->getDefinitions()->willReturn($definitions);

// Set up expected calls for getParents() and setDefinitions().
$event->getParents()->willReturn(['US']);
Expand All @@ -74,7 +84,7 @@ public function testOnSubdivisions() {
*
* @covers ::onSubdivisions
*/
public function testOnSubdivisionsNonUS() {
public function testOnSubdivisionsNonUs() {
// Create a mock event.
/** @var \Prophecy\Prophecy\ObjectProphecy|\Drupal\address\Event\SubdivisionsEvent $event */
$event = $this->prophesize(SubdivisionsEvent::class);
Expand Down

0 comments on commit 51bf2a5

Please sign in to comment.