diff --git a/Tests/SendConsignments/SendMuliColoConsignmentTest.php b/Tests/SendConsignments/SendMuliColoConsignmentTest.php index 8476ec67..e3253f28 100755 --- a/Tests/SendConsignments/SendMuliColoConsignmentTest.php +++ b/Tests/SendConsignments/SendMuliColoConsignmentTest.php @@ -14,6 +14,7 @@ namespace MyParcelNL\Sdk\tests\SendConsignments\SendOneConsignmentTest; use MyParcelNL\Sdk\src\Helper\MyParcelCollection; +use MyParcelNL\Sdk\src\Model\MyParcelConsignment; use MyParcelNL\Sdk\src\Model\Repository\MyParcelConsignmentRepository; @@ -85,7 +86,7 @@ public function testMultiColo() $consignment->setLabelDescription($consignmentTest['label_description']); } - $myParcelCollection = $myParcelCollection->addMultiCollo($consignment, $consignmentTest['multi_collo_amount']); + $myParcelCollection->addMultiCollo($consignment, $consignmentTest['multi_collo_amount']); $this->assertCount($consignmentTest['multi_collo_amount'], $myParcelCollection); @@ -97,11 +98,11 @@ public function testMultiColo() $this->assertEquals(true, preg_match("#^https://api.myparcel.nl/pdfs#", $myParcelCollection->getLinkOfLabels()), 'Can\'t get link of PDF'); - /** @var MyParcelConsignmentRepository $consignment */ - $consignment = $myParcelCollection->getConsignments()[0]; - $this->assertEquals(true, preg_match("#^3SMYPA#", $consignment->getBarcode()), 'Barcode is not set'); + /** @var MyParcelConsignment[] $consignments */ + $consignments = $myParcelCollection->getConsignments(); - /** @todo; clear consignment in MyParcelCollection */ + $this->assertNotEquals($consignments[0]->getMyParcelConsignmentId(), $consignments[1]->getMyParcelConsignmentId()); + $this->assertNotEquals($consignments[0]->getBarcode(), $consignments[1]->getBarcode()); } } diff --git a/composer.json b/composer.json index 1592a6d6..51728694 100755 --- a/composer.json +++ b/composer.json @@ -1,9 +1,9 @@ { "name": "myparcelnl/sdk", - "version": "v2.1.0-beta.1", + "version": "v2.1.0-beta.2", "description": "This package is designed to send and receive data from MyParcel by means of an API.", "homepage": "https://www.myparcel.nl", - "tags": ["MyParcel", "My Parcel", "Post NL", "PostNL"], + "tags": ["MyParcel", "My Parcel", "Flespakket", "Post NL", "PostNL"], "license": "GPL-3.0-or-later", "authors": [ { diff --git a/src/Helper/MyParcelCollection.php b/src/Helper/MyParcelCollection.php index 4a2f773b..f748e810 100644 --- a/src/Helper/MyParcelCollection.php +++ b/src/Helper/MyParcelCollection.php @@ -593,7 +593,7 @@ private function apiEncodeReturnShipment($consignment) */ private function getNewCollectionFromResult($result) { - $newCollection = new MyParcelCollection(); + $newCollection = new static; foreach ($result as $shipment) { /** @var Collection|MyParcelConsignment[] $consignments */ diff --git a/src/Services/CollectionEncode.php b/src/Services/CollectionEncode.php index b0d752a3..ce96cf2c 100644 --- a/src/Services/CollectionEncode.php +++ b/src/Services/CollectionEncode.php @@ -53,7 +53,7 @@ public function encode() */ private function groupMultiColloConsignments() { - return $this->consignments->groupBy(function (MyParcelConsignment $consignment) { + return $this->consignments->groupBy(function(MyParcelConsignment $consignment) { if ($consignment->isPartOfMultiCollo()) { return $consignment->getReferenceId(); }