From 12bebc54b157c1bf6b7ab166cb3b0cd297357902 Mon Sep 17 00:00:00 2001 From: markernst97 Date: Wed, 31 Jan 2024 13:40:50 +0100 Subject: [PATCH] test: update test --- .../Consignment/AbstractConsignmentTest.php | 89 +++++++++++++++++++ test/Model/Consignment/UPSConsignmentTest.php | 2 +- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 test/Model/Consignment/AbstractConsignmentTest.php diff --git a/test/Model/Consignment/AbstractConsignmentTest.php b/test/Model/Consignment/AbstractConsignmentTest.php new file mode 100644 index 00000000..6d32b656 --- /dev/null +++ b/test/Model/Consignment/AbstractConsignmentTest.php @@ -0,0 +1,89 @@ + 'NL', + 'city' => 'Heerhugowaard', + 'street' => 'Dorpsstraat', + 'number' => '1', + 'box_number' => '2', + 'number_suffix' => 'b', + 'region' => 'Noord-Holland', + 'state' => 'NH', + 'postal_code' => '1701AA', + 'person' => 'Pietje Puk', + 'package_type' => AbstractConsignment::PACKAGE_TYPE_PACKAGE, + 'only_recipient' => true, + 'signature' => true, + 'return' => true, + 'large_format' => true, + 'age_check' => true, + 'label_description' => 'Voorbeeld123', + 'shop_id' => 1, + 'status' => 99, + 'external_identifier' => '123456789', + 'barcode' => '3STOIS912345678', + ]; + + /** + * @return void + * @throws \MyParcelNL\Sdk\src\Exception\MissingFieldException + */ + public function testAbstractConsignment(): void + { + $consignment = new PostNLConsignment(); + + $consignment + ->setCountry(self::TEST_DATA['cc']) + ->setCity(self::TEST_DATA['city']) + ->setStreet(self::TEST_DATA['street']) + ->setNumber(self::TEST_DATA['number']) + ->setBoxNumber(self::TEST_DATA['box_number']) + ->setNumberSuffix(self::TEST_DATA['number_suffix']) + ->setRegion(self::TEST_DATA['region']) + ->setState(self::TEST_DATA['state']) + ->setPostalCode(self::TEST_DATA['postal_code']) + ->setPerson(self::TEST_DATA['person']) + ->setPackageType(self::TEST_DATA['package_type']) + ->setOnlyRecipient(self::TEST_DATA['only_recipient']) + ->setSignature(self::TEST_DATA['signature']) + ->setReturn(self::TEST_DATA['return']) + ->setLargeFormat(self::TEST_DATA['large_format']) + ->setAgeCheck(self::TEST_DATA['age_check']) + ->setLabelDescription(self::TEST_DATA['label_description']) + ->setShopId(self::TEST_DATA['shop_id']) + ->setStatus(self::TEST_DATA['status']) + ->setExternalIdentifier(self::TEST_DATA['external_identifier']) + ->setBarcode(self::TEST_DATA['barcode']); + + self::assertEquals(self::TEST_DATA['cc'], $consignment->getCountry()); + self::assertEquals(self::TEST_DATA['city'], $consignment->getCity()); + self::assertEquals(self::TEST_DATA['street'], $consignment->getStreet()); + self::assertEquals(self::TEST_DATA['number'], $consignment->getNumber()); + self::assertEquals(self::TEST_DATA['box_number'], $consignment->getBoxNumber()); + self::assertEquals(self::TEST_DATA['number_suffix'], $consignment->getNumberSuffix()); + self::assertEquals(self::TEST_DATA['region'], $consignment->getRegion()); + self::assertEquals(self::TEST_DATA['state'], $consignment->getState()); + self::assertEquals(self::TEST_DATA['postal_code'], $consignment->getPostalCode()); + self::assertEquals(self::TEST_DATA['person'], $consignment->getPerson()); + self::assertEquals(self::TEST_DATA['only_recipient'], $consignment->isOnlyRecipient()); + self::assertEquals(self::TEST_DATA['signature'], $consignment->isSignature()); + self::assertEquals(self::TEST_DATA['return'], $consignment->isReturn()); + self::assertEquals(self::TEST_DATA['large_format'], $consignment->isLargeFormat()); + self::assertEquals(self::TEST_DATA['age_check'], $consignment->hasAgeCheck()); + self::assertEquals(self::TEST_DATA['label_description'], $consignment->getLabelDescription()); + self::assertEquals(self::TEST_DATA['shop_id'], $consignment->getShopId()); + self::assertEquals(self::TEST_DATA['status'], $consignment->getStatus()); + self::assertEquals(self::TEST_DATA['external_identifier'], $consignment->getExternalIdentifier()); + self::assertEquals(self::TEST_DATA['barcode'], $consignment->getBarcode()); + } +} diff --git a/test/Model/Consignment/UPSConsignmentTest.php b/test/Model/Consignment/UPSConsignmentTest.php index 81b3ad60..38c8c08f 100644 --- a/test/Model/Consignment/UPSConsignmentTest.php +++ b/test/Model/Consignment/UPSConsignmentTest.php @@ -28,7 +28,7 @@ public function provideUPSConsignmentsData(): array * @throws \Exception * @dataProvider provideUPSConsignmentsData */ - public function testUPSForYouConsignments(array $testData): void + public function testUPSConsignments(array $testData): void { $this->doConsignmentTest($testData); }