From 51bf2a58ff1934ed8af24846622d46a9e14314fe Mon Sep 17 00:00:00 2001 From: Christian Burk <766573+omahane@users.noreply.github.com> Date: Wed, 18 Dec 2024 17:10:21 -0800 Subject: [PATCH] VACMS-19227: Refactors test to includ getDefinitions --- .../AddPhilippinesAsStateSubscriberTest.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/va_gov_address/unit/EventSubscriber/AddPhilippinesAsStateSubscriberTest.php b/tests/phpunit/va_gov_address/unit/EventSubscriber/AddPhilippinesAsStateSubscriberTest.php index e9fc1b1773..e96797f47d 100644 --- a/tests/phpunit/va_gov_address/unit/EventSubscriber/AddPhilippinesAsStateSubscriberTest.php +++ b/tests/phpunit/va_gov_address/unit/EventSubscriber/AddPhilippinesAsStateSubscriberTest.php @@ -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']); @@ -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);