From cd736c0d9784c7b9f9cb2f1ce03229e094764ce5 Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Wed, 4 Dec 2019 16:06:49 +0200 Subject: [PATCH 01/58] Fix doctrine annotation laoder issue (#1) --- library/Xi/Netvisor/Resource/Xml/Component/Root.php | 8 ++++++++ library/Xi/Netvisor/Resource/Xml/Customer.php | 2 ++ library/Xi/Netvisor/Resource/Xml/SalesInvoice.php | 2 ++ 3 files changed, 12 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/Component/Root.php b/library/Xi/Netvisor/Resource/Xml/Component/Root.php index 389ffd8..c81b2ed 100644 --- a/library/Xi/Netvisor/Resource/Xml/Component/Root.php +++ b/library/Xi/Netvisor/Resource/Xml/Component/Root.php @@ -2,8 +2,16 @@ namespace Xi\Netvisor\Resource\Xml\Component; +use Doctrine\Common\Annotations\AnnotationRegistry; + abstract class Root { + public function __construct() + { + // This is important for Doctrine annotation reader to work + AnnotationRegistry::registerLoader('class_exists'); + } + /** * File path to a DTD file * which should be used for XML validation. diff --git a/library/Xi/Netvisor/Resource/Xml/Customer.php b/library/Xi/Netvisor/Resource/Xml/Customer.php index 84ec107..13dea99 100644 --- a/library/Xi/Netvisor/Resource/Xml/Customer.php +++ b/library/Xi/Netvisor/Resource/Xml/Customer.php @@ -16,6 +16,8 @@ public function __construct( CustomerBaseInformation $customerBaseInformation, CustomerFinvoiceDetails $customerFinvoiceDetails = null ) { + parent::__construct(); + $this->customerBaseInformation = $customerBaseInformation; $this->customerFinvoiceDetails = $customerFinvoiceDetails; } diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php index 96c4229..96320fc 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php @@ -37,6 +37,8 @@ public function __construct( $invoicingCustomerIdentifier, $paymentTermNetDays ) { + parent::__construct(); + $this->salesInvoiceDate = $salesInvoiceDate->format('Y-m-d'); $this->salesInvoiceAmount = $salesInvoiceAmount; $this->salesInvoiceStatus = new AttributeElement($salesInvoiceStatus, array('type' => 'netvisor')); From 65b2b228807bcb73050d57884aa9ff827774cb6e Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Thu, 5 Dec 2019 09:06:50 +0200 Subject: [PATCH 02/58] Dimensions for invoice lines (#2) --- .../Xi/Netvisor/Resource/Xml/Dimension.php | 21 ++++++++++++++++ .../Resource/Xml/SalesInvoiceProductLine.php | 17 +++++++++++++ .../Resource/Xml/SalesInvoiceTest.php | 25 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 library/Xi/Netvisor/Resource/Xml/Dimension.php diff --git a/library/Xi/Netvisor/Resource/Xml/Dimension.php b/library/Xi/Netvisor/Resource/Xml/Dimension.php new file mode 100644 index 0000000..6b74fe0 --- /dev/null +++ b/library/Xi/Netvisor/Resource/Xml/Dimension.php @@ -0,0 +1,21 @@ +dimensionname = $dimensionname; + $this->dimensionitem = $dimensionitem; + } +} diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php index 4886418..65e086c 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php @@ -2,6 +2,7 @@ namespace Xi\Netvisor\Resource\Xml; +use JMS\Serializer\Annotation\XmlList; use Xi\Netvisor\Resource\Xml\Component\AttributeElement; class SalesInvoiceProductLine @@ -12,6 +13,11 @@ class SalesInvoiceProductLine private $productVatPercentage; private $salesInvoiceProductLineQuantity; + /** + * @XmlList(inline = true, entry = "dimension") + */ + private $dimensions = []; + /** * @param string $productIdentifier * @param string $productName @@ -32,4 +38,15 @@ public function __construct( $this->productVatPercentage = new AttributeElement($productVatPercentage, array('vatcode' => 'KOMY')); // TODO: different values. $this->salesInvoiceProductLineQuantity = $salesInvoiceProductLineQuantity; } + + /** + * @param string $name + * @param string $item + * @return self + */ + public function addDimension($name, $item): self + { + $this->dimensions[] = new Dimension($name, $item); + return $this; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php index cd8a379..0ed859b 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php @@ -70,4 +70,29 @@ public function xmlHasAddedSalesInvoiceProductLines() $this->assertXmlContainsTagWithValue('productidentifier', '1', $xml); $this->assertXmlContainsTagWithValue('productidentifier', '2', $xml); } + + /** + * @test + */ + public function xmlHasAddedSalesInvoiceProductDimensionLines() + { + $name = 'Test dimension name'; + $item = 'Test dimension item'; + $name2 = 'Another test dimension name'; + $item2 = 'Another test dimension item'; + + $productLine = new SalesInvoiceProductLine('1', 'A', '1,00', '24', '1'); + $productLine->addDimension($name, $item); + $productLine->addDimension($name2, $item2); + + $this->invoice->addSalesInvoiceProductLine($productLine); + + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $this->assertSame(2, substr_count($xml, '')); + $this->assertContains($name, $xml); + $this->assertContains($item, $xml); + $this->assertContains($name2, $xml); + $this->assertContains($item, $xml); + } } From f4074e500062d0d08182a0c5021e77006d585271 Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Thu, 5 Dec 2019 09:41:49 +0200 Subject: [PATCH 03/58] Invoice line unit price type editable (#3) * Relocate test * Compatible with older php versions * Can update AttributeElement attributes * Ability to set invoice line unit price type --- .../Xml/Component/AttributeElement.php | 27 ++++++++++++ .../Resource/Xml/SalesInvoiceProductLine.php | 22 +++++++++- .../Xml/Component/AttributeElementTest.php | 37 ++++++++++++++++ .../Xml/SalesInvoiceProductLineTest.php | 42 +++++++++++++++++++ .../Resource/Xml/SalesInvoiceTest.php | 25 ----------- 5 files changed, 126 insertions(+), 27 deletions(-) create mode 100644 tests/Xi/Netvisor/Resource/Xml/Component/AttributeElementTest.php diff --git a/library/Xi/Netvisor/Resource/Xml/Component/AttributeElement.php b/library/Xi/Netvisor/Resource/Xml/Component/AttributeElement.php index 821513d..eb783f3 100644 --- a/library/Xi/Netvisor/Resource/Xml/Component/AttributeElement.php +++ b/library/Xi/Netvisor/Resource/Xml/Component/AttributeElement.php @@ -26,4 +26,31 @@ public function __construct($value, $attributes) $this->value = $value; $this->attributes = $attributes; } + + /** + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * @return array + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * @param string $attribute + * @param array $value + * @return self + */ + public function setAttribute($attribute, $value) + { + $this->attributes[$attribute] = $value; + return $this; + } } diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php index 65e086c..c7da272 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php @@ -7,6 +7,9 @@ class SalesInvoiceProductLine { + const UNIT_PRICE_TYPE_WITH_VAT = 'gross'; + const UNIT_PRICE_TYPE_WITHOUT_VAT = 'net'; + private $productIdentifier; private $productName; private $productUnitPrice; @@ -34,7 +37,11 @@ public function __construct( ) { $this->productIdentifier = new AttributeElement($productIdentifier, array('type' => 'netvisor')); // TODO: netvisor/customer. $this->productName = substr($productName, 0, 50); - $this->productUnitPrice = new AttributeElement($productUnitPrice, array('type' => 'net')); // TODO: net/gross. + + $this->productUnitPrice = new AttributeElement( + $productUnitPrice, array('type' => self::UNIT_PRICE_TYPE_WITHOUT_VAT) + ); + $this->productVatPercentage = new AttributeElement($productVatPercentage, array('vatcode' => 'KOMY')); // TODO: different values. $this->salesInvoiceProductLineQuantity = $salesInvoiceProductLineQuantity; } @@ -44,9 +51,20 @@ public function __construct( * @param string $item * @return self */ - public function addDimension($name, $item): self + public function addDimension($name, $item) { $this->dimensions[] = new Dimension($name, $item); return $this; } + + /** + * @param string $name + * @param string $item + * @return self + */ + public function setUnitPriceType($type) + { + $this->productUnitPrice->setAttribute('type', $type); + return $this; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/Component/AttributeElementTest.php b/tests/Xi/Netvisor/Resource/Xml/Component/AttributeElementTest.php new file mode 100644 index 0000000..0190054 --- /dev/null +++ b/tests/Xi/Netvisor/Resource/Xml/Component/AttributeElementTest.php @@ -0,0 +1,37 @@ + 'Attribute' + ]; + + $attributeElement = new AttributeElement( + $value, + $attributes + ); + + $this->assertSame($value, $attributeElement->getValue()); + $this->assertSame($attributes, $attributeElement->getAttributes()); + } + + public function testSetAttribute() + { + $key = 'test'; + $attribute = 'First Attribute'; + + $attributeElement = new AttributeElement('', [$key => $attribute]); + $this->assertSame($attribute, $attributeElement->getAttributes()[$key]); + + $attribute = 'Second Attribute'; + $attributeElement->setAttribute($key, $attribute); + $this->assertSame($attribute, $attributeElement->getAttributes()[$key]); + } +} diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 0599857..84e9eb6 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -46,4 +46,46 @@ public function xmlHasRequiredProductLineValues() $this->assertXmlContainsTagWithValue('salesinvoiceproductlinequantity', 5, $xml); } + + /** + * @test + */ + public function xmlHasAddedDimensionLines() + { + $name = 'Test dimension name'; + $item = 'Test dimension item'; + $name2 = 'Another test dimension name'; + $item2 = 'Another test dimension item'; + + $this->invoiceProductLine->addDimension($name, $item); + $this->invoiceProductLine->addDimension($name2, $item2); + + $xml = $this->toXml($this->invoiceProductLine); + + $this->assertSame(2, substr_count($xml, '')); + $this->assertContains($name, $xml); + $this->assertContains($item, $xml); + $this->assertContains($name2, $xml); + $this->assertContains($item, $xml); + } + + /** + * @dataProvider unitPriceTypeProvider + */ + public function testSetUnitPriceType($type) + { + $this->invoiceProductLine->setUnitPriceType($type); + + $xml = $this->toXml($this->invoiceProductLine); + + $this->assertXmlContainsTagWithAttributes('productunitprice', array('type' => $type), $xml); + } + + public function unitPriceTypeProvider() + { + return [ + [SalesInvoiceProductLine::UNIT_PRICE_TYPE_WITH_VAT], + [SalesInvoiceProductLine::UNIT_PRICE_TYPE_WITHOUT_VAT], + ]; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php index 0ed859b..cd8a379 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php @@ -70,29 +70,4 @@ public function xmlHasAddedSalesInvoiceProductLines() $this->assertXmlContainsTagWithValue('productidentifier', '1', $xml); $this->assertXmlContainsTagWithValue('productidentifier', '2', $xml); } - - /** - * @test - */ - public function xmlHasAddedSalesInvoiceProductDimensionLines() - { - $name = 'Test dimension name'; - $item = 'Test dimension item'; - $name2 = 'Another test dimension name'; - $item2 = 'Another test dimension item'; - - $productLine = new SalesInvoiceProductLine('1', 'A', '1,00', '24', '1'); - $productLine->addDimension($name, $item); - $productLine->addDimension($name2, $item2); - - $this->invoice->addSalesInvoiceProductLine($productLine); - - $xml = $this->toXml($this->invoice->getSerializableObject()); - - $this->assertSame(2, substr_count($xml, '')); - $this->assertContains($name, $xml); - $this->assertContains($item, $xml); - $this->assertContains($name2, $xml); - $this->assertContains($item, $xml); - } } From db70f71c39792ae0a152bb1810b1b1266d7d8188 Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Thu, 5 Dec 2019 10:11:15 +0200 Subject: [PATCH 04/58] Add free text to invoice product line (#4) --- .../Netvisor/Resource/Xml/SalesInvoiceProductLine.php | 11 +++++++++++ .../Resource/Xml/SalesInvoiceProductLineTest.php | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php index c7da272..5d36012 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php @@ -15,6 +15,7 @@ class SalesInvoiceProductLine private $productUnitPrice; private $productVatPercentage; private $salesInvoiceProductLineQuantity; + private $salesinvoiceproductlinefreetext; /** * @XmlList(inline = true, entry = "dimension") @@ -67,4 +68,14 @@ public function setUnitPriceType($type) $this->productUnitPrice->setAttribute('type', $type); return $this; } + + /** + * @param string $text + * @return self + */ + public function setFreeTezt($text) + { + $this->salesinvoiceproductlinefreetext = $text; + return $this; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 84e9eb6..6a6c86e 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -88,4 +88,14 @@ public function unitPriceTypeProvider() [SalesInvoiceProductLine::UNIT_PRICE_TYPE_WITHOUT_VAT], ]; } + + public function testSetFreeText() + { + $text = 'Additional information'; + $this->invoiceProductLine->setFreeTezt($text); + + $xml = $this->toXml($this->invoiceProductLine); + + $this->assertXmlContainsTagWithValue('salesinvoiceproductlinefreetext', $text, $xml); + } } From 90ddcd528e641259e495d67a3c3718bbd7f343e6 Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Thu, 5 Dec 2019 11:03:44 +0200 Subject: [PATCH 05/58] Delivery receiver details to SalesInvoice (#5) --- .../Xi/Netvisor/Resource/Xml/SalesInvoice.php | 48 +++++++++++++++++++ .../Resource/Xml/SalesInvoiceTest.php | 42 ++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php index 96320fc..58b545d 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php @@ -17,6 +17,11 @@ class SalesInvoice extends Root private $salesInvoiceStatus; private $invoicingCustomerIdentifier; private $paymentTermNetDays; + private $deliveryaddressname; + private $deliveryaddressline; + private $deliveryaddresspostnumber; + private $deliveryaddresstown; + private $deliveryaddresscountrycode; /** * @XmlList(entry = "invoiceline") @@ -48,10 +53,53 @@ public function __construct( /** * @param SalesInvoiceProductLine $line + * @return self */ public function addSalesInvoiceProductLine(SalesInvoiceProductLine $line) { $this->invoiceLines[] = new WrapperElement('salesinvoiceproductline', $line); + return $this; + } + + /** + * @param string $receiverName + * @param string $streetAddress + * @param string $postNumber + * @param string $town + * @param string $countryCode + * @return self + */ + public function setDeliveryReceiverDetails( + $receiverName, + $streetAddress, + $postNumber, + $town, + $countryCode + ) { + $map = [ + 'deliveryaddressname' => $receiverName, + 'deliveryaddressline' => $streetAddress, + 'deliveryaddresspostnumber' => $postNumber, + 'deliveryaddresstown' => $town, + 'deliveryaddresscountrycode' => $countryCode, + ]; + + foreach ($map as $xmlField => $value) { + if (!$value) { + $this->$xmlField = null; + continue; + } + + $attributes = array(); + + if ($xmlField === 'deliveryaddresscountrycode') { + $attributes = array('type' => 'ISO-3316'); + } + + $this->$xmlField = new AttributeElement($value, $attributes); + } + + return $this; } public function getDtdPath() diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php index cd8a379..baa7155 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php @@ -70,4 +70,46 @@ public function xmlHasAddedSalesInvoiceProductLines() $this->assertXmlContainsTagWithValue('productidentifier', '1', $xml); $this->assertXmlContainsTagWithValue('productidentifier', '2', $xml); } + + public function testSetDeliveryReceiverDetails() + { + $receiverName = 'Receiver'; + $streetAddress = 'Street address'; + $postNumber = '12345'; + $town = 'Town'; + $countryCode = 'FI'; + + // With all values + $this->invoice->setDeliveryReceiverDetails( + $receiverName, + $streetAddress, + $postNumber, + $town, + $countryCode + ); + + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $this->assertXmlContainsTagWithValue('deliveryaddressname', $receiverName, $xml); + $this->assertXmlContainsTagWithValue('deliveryaddressline', $streetAddress, $xml); + $this->assertXmlContainsTagWithValue('deliveryaddresspostnumber', $postNumber, $xml); + $this->assertXmlContainsTagWithValue('deliveryaddresstown', $town, $xml); + $this->assertXmlContainsTagWithValue('deliveryaddresscountrycode', $countryCode, $xml); + + $this->assertXmlContainsTagWithAttributes( + 'deliveryaddresscountrycode', + array('type' => 'ISO-3316'), + $xml + ); + + // Test with string, null or empty values + $this->invoice->setDeliveryReceiverDetails($receiverName, null, '', null, ''); + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $this->assertXmlContainsTagWithValue('deliveryaddressname', $receiverName, $xml); + $this->assertNotContains('deliveryaddressline', $xml); + $this->assertNotContains('deliveryaddresspostnumber', $xml); + $this->assertNotContains('deliveryaddresstown', $xml); + $this->assertNotContains('deliveryaddresscountrycode', $xml); + } } From 87f79cf539a51003c2e09dbdeffd3379d215e5e1 Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Thu, 5 Dec 2019 15:51:28 +0200 Subject: [PATCH 06/58] Ability to edit customer (#6) --- library/Xi/Netvisor/Netvisor.php | 16 +++++++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 31 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 1697383..1b9d457 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -97,6 +97,22 @@ public function sendCustomer(Customer $customer) return $this->requestWithBody($customer, 'customer', ['method' => 'add']); } + /** + * @param Customer $customer + * @return null|string + */ + public function updateCustomer(Customer $customer, int $id) + { + return $this->requestWithBody( + $customer, + 'customer', + [ + 'method' => 'Edit', + 'id' => $id, + ] + ); + } + /** * List customers, optionally filtered by a keyword. * diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 4c4fe09..5575095 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -5,6 +5,7 @@ use Xi\Netvisor\Component\Validate; use Xi\Netvisor\Netvisor; use Xi\Netvisor\Config; +use Xi\Netvisor\Resource\Xml\Customer; use Xi\Netvisor\Resource\Xml\SalesInvoice; use GuzzleHttp\Client; use Xi\Netvisor\Resource\Xml\TestResource; @@ -154,4 +155,34 @@ public function processInvoiceToWorkWithNetvisor() $this->assertEquals('2014-02-17', $this->netvisor->processXml($xml)); } + + public function testUpdateCustomer() + { + // Expected params + $id = 12345; + + $attributes = [ + 'method' => 'Edit', + 'id' => $id, + ]; + + $customerMock = $this + ->getMockBuilder(Customer::class) + ->disableOriginalConstructor() + ->getMock(); + + // Mock requestWithBody + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['requestWithBody']) + ->getMock(); + + $netvisorMock + ->expects($this->once()) + ->method('requestWithBody') + ->with($customerMock, 'customer', $attributes); + + $netvisorMock->updateCustomer($customerMock, $id); + } } From 59dc9f9a7814a5e4c82809089c761dfd671f4bd5 Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Thu, 5 Dec 2019 16:00:45 +0200 Subject: [PATCH 07/58] Bug fix on customer edit action (#7) --- library/Xi/Netvisor/Netvisor.php | 2 +- tests/Xi/Netvisor/NetvisorTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 1b9d457..d90c8d0 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -107,7 +107,7 @@ public function updateCustomer(Customer $customer, int $id) $customer, 'customer', [ - 'method' => 'Edit', + 'method' => 'edit', 'id' => $id, ] ); diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 5575095..a244f2b 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -162,7 +162,7 @@ public function testUpdateCustomer() $id = 12345; $attributes = [ - 'method' => 'Edit', + 'method' => 'edit', 'id' => $id, ]; From 1f36ea46975e21f6b31f013af7c1d0f02cabab66 Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Mon, 9 Dec 2019 09:10:32 +0200 Subject: [PATCH 08/58] Extend customer data (#8) --- .../Resource/Xml/CustomerBaseInformation.php | 54 ++++++++++++- .../Xi/Netvisor/Resource/Xml/CustomerTest.php | 79 ++++++++++++++++--- .../Xml/SalesInvoiceProductLineTest.php | 2 +- tests/Xi/Netvisor/XmlTestCase.php | 17 +++- 4 files changed, 136 insertions(+), 16 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php b/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php index 0b1223e..ffa9d0c 100644 --- a/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php +++ b/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php @@ -10,9 +10,12 @@ class CustomerBaseInformation private $city; private $postNumber; private $country; + private $organizationunitnumber; + private $phonenumber; + private $email; + private $isprivatecustomer = 0; /** - * @param string $externalIdentifier * @param string $name * @param string $streetAddress * @param string $city @@ -20,18 +23,63 @@ class CustomerBaseInformation * @param string $country */ public function __construct( - $externalIdentifier, $name, $streetAddress, $city, $postNumber, $country ) { - $this->externalIdentifier = $externalIdentifier; $this->name = $name; $this->streetAddress = $streetAddress; $this->city = $city; $this->postNumber = $postNumber; $this->country = $country; } + + /** + * @param string $ovt + * @return self + */ + public function setOvt($ovt) + { + $this->organizationunitnumber = $ovt; + return $this; + } + + /** + * @param string $number + * @return self + */ + public function setPhoneNumber($number) + { + $this->phonenumber = $number; + return $this; + } + + /** + * @param string $email + * @return self + */ + public function setEmail($email) + { + $this->email = $email; + return $this; + } + + /** + * @param string $od + * @return self + */ + public function setBusinessId($id) + { + $this->externalIdentifier = null; + $this->isprivatecustomer = 0; + + if ($id) { + $this->externalIdentifier = $id; + $this->isprivatecustomer = 1; + } + + return $this; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php index e19a078..285e66c 100644 --- a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php @@ -6,6 +6,7 @@ use Xi\Netvisor\Resource\Xml\Component\AttributeElement; use Xi\Netvisor\Resource\Xml\Component\WrapperElement; use Xi\Netvisor\Resource\Xml\Customer; +use Xi\Netvisor\Resource\Xml\CustomerBaseInformation; use Xi\Netvisor\XmlTestCase; class CustomerTest extends XmlTestCase @@ -15,21 +16,24 @@ class CustomerTest extends XmlTestCase */ private $customer; + /** + * @var CustomerBaseInformation + */ + private $baseInformation; + public function setUp() { parent::setUp(); - $this->customer = new Customer( - new CustomerBaseInformation( - '1234567-1', - 'Testi Oy', - 'Testikatu 1', - 'Helsinki', - '00240', - 'FI' - ), - null + $this->baseInformation = new CustomerBaseInformation( + 'Testi Oy', + 'Testikatu 1', + 'Helsinki', + '00240', + 'FI' ); + + $this->customer = new Customer($this->baseInformation, null); } /** @@ -47,7 +51,60 @@ public function xmlHasRequiredValues() { $xml = $this->toXml($this->customer->getSerializableObject()); - $this->assertXmlContainsTagWithValue('externalidentifier', '1234567-1', $xml); $this->assertXmlContainsTagWithValue('name', 'Testi Oy', $xml); } + + public function testSetOvt() + { + $ovt = '001231564'; + $this->baseInformation->setOvt($ovt); + $xml = $this->toXml($this->customer->getSerializableObject()); + $this->assertXmlContainsTagWithValue('organizationunitnumber', $ovt, $xml); + } + + public function testSetPhoneNumber() + { + $number = '0501234567'; + $this->baseInformation->setPhoneNumber($number); + $xml = $this->toXml($this->customer->getSerializableObject()); + $this->assertXmlContainsTagWithValue('phonenumber', $number, $xml); + } + + public function testSetEmail() + { + $email = 'asdf@asdf.fi'; + $this->baseInformation->setEmail($email); + $xml = $this->toXml($this->customer->getSerializableObject()); + $this->assertXmlContainsTagWithValue('email', $email, $xml); + } + + /** + * @dataProvider businessIdProvider + */ + public function testSetBusinessId($id) + { + if (!is_null($id)) { + $this->baseInformation->setBusinessId($id); + } + + $xml = $this->toXml($this->customer->getSerializableObject()); + + if (!$id) { + $this->assertXmlDoesNotContainTag('externalidentifier', $xml); + $this->assertXmlContainsTagWithValue('isprivatecustomer', 0, $xml); + return; + } + + $this->assertXmlContainsTagWithValue('externalidentifier', $id, $xml); + $this->assertXmlContainsTagWithValue('isprivatecustomer', 1, $xml); + } + + public function businessIdProvider() + { + return [ + ['9-876543'], + [''], + [null], + ]; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 6a6c86e..6070d18 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -44,7 +44,7 @@ public function xmlHasRequiredProductLineValues() $this->assertXmlContainsTagWithValue('productvatpercentage', '24', $xml); $this->assertXmlContainsTagWithAttributes('productvatpercentage', array('vatcode' => 'KOMY'), $xml); - $this->assertXmlContainsTagWithValue('salesinvoiceproductlinequantity', 5, $xml); + $this->assertXmlContainsTagWithValue('salesinvoiceproductlinequantity', '5', $xml); } /** diff --git a/tests/Xi/Netvisor/XmlTestCase.php b/tests/Xi/Netvisor/XmlTestCase.php index 57aa3b7..b3a3eef 100644 --- a/tests/Xi/Netvisor/XmlTestCase.php +++ b/tests/Xi/Netvisor/XmlTestCase.php @@ -38,7 +38,22 @@ public function toXml($object) public function assertXmlContainsTagWithValue($tag, $value, $xml) { $this->assertContains(sprintf('<%s', $tag), $xml); - $this->assertContains(sprintf('>', $value, $tag), $xml); // TODO: Integers are not enclosed with CDATA. + + if (is_int($value)) { + $this->assertContains(sprintf('>%s', $value, $tag), $xml); + return; + } + + $this->assertContains(sprintf('>', $value, $tag), $xml); + } + + /** + * @param string $tag + * @param string $xml + */ + public function assertXmlDoesNotContainTag($tag, $xml) + { + $this->assertNotContains(sprintf('<%s', $tag), $xml); } /** From eb7b6a5d738f7be91191242a5949a25d75e15bb1 Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Tue, 10 Dec 2019 09:16:51 +0200 Subject: [PATCH 09/58] Fix typo (#9) --- library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php | 2 +- tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php index 5d36012..bafa7b8 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php @@ -73,7 +73,7 @@ public function setUnitPriceType($type) * @param string $text * @return self */ - public function setFreeTezt($text) + public function setFreeText($text) { $this->salesinvoiceproductlinefreetext = $text; return $this; diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 6070d18..517627b 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -92,7 +92,7 @@ public function unitPriceTypeProvider() public function testSetFreeText() { $text = 'Additional information'; - $this->invoiceProductLine->setFreeTezt($text); + $this->invoiceProductLine->setFreeText($text); $xml = $this->toXml($this->invoiceProductLine); From cde9f4feff88b967e00950ebeab9b378e530e64d Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Tue, 10 Dec 2019 13:39:26 +0200 Subject: [PATCH 10/58] Reference invoicenumber freetextafterlines data (#10) --- .../Xi/Netvisor/Resource/Xml/SalesInvoice.php | 33 +++++++++++++++++++ .../Resource/Xml/SalesInvoiceTest.php | 32 ++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php index 58b545d..69d80c6 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php @@ -22,6 +22,9 @@ class SalesInvoice extends Root private $deliveryaddresspostnumber; private $deliveryaddresstown; private $deliveryaddresscountrycode; + private $salesinvoicenumber; + private $salesinvoicereferencenumber; + private $salesinvoicefreetextafterlines; /** * @XmlList(entry = "invoiceline") @@ -102,6 +105,36 @@ public function setDeliveryReceiverDetails( return $this; } + /** + * @param string $invoiceNumber + * @return self + */ + public function setInvoiceNumber($invoiceNumber) + { + $this->salesinvoicenumber = $invoiceNumber; + return $this; + } + + /** + * @param string $referenceNumber + * @return self + */ + public function setReferenceNumber($referenceNumber) + { + $this->salesinvoicereferencenumber = $referenceNumber; + return $this; + } + + /** + * @param string $text + * @return self + */ + public function setAfterLinesText($text) + { + $this->salesinvoicefreetextafterlines = $text; + return $this; + } + public function getDtdPath() { return $this->getDtdFile('salesinvoice.dtd'); diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php index baa7155..9d13746 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php @@ -112,4 +112,36 @@ public function testSetDeliveryReceiverDetails() $this->assertNotContains('deliveryaddresstown', $xml); $this->assertNotContains('deliveryaddresscountrycode', $xml); } + + public function testSetInvoiceNumber() + { + $invoiceNumber = '0123456'; + + $this->invoice->setInvoiceNumber($invoiceNumber); + $xml = $this->toXml($this->invoice->getSerializableObject()); + $this->assertXmlContainsTagWithValue('salesinvoicenumber', $invoiceNumber, $xml); + } + + public function testSetReferenceNumber() + { + $referenceNumber = '0987654'; + + $this->invoice->setReferenceNumber($referenceNumber); + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $this->assertXmlContainsTagWithValue( + 'salesinvoicereferencenumber', + $referenceNumber, + $xml + ); + } + + public function testSetAfterLinesText() + { + $text = 'Some additional data'; + + $this->invoice->setAfterLinesText($text); + $xml = $this->toXml($this->invoice->getSerializableObject()); + $this->assertXmlContainsTagWithValue('salesinvoicefreetextafterlines', $text, $xml); + } } From 20fb739339c5a5eae624da257ae2b8cb6f8585d7 Mon Sep 17 00:00:00 2001 From: petteri-hakala <58517212+petteri-hakala@users.noreply.github.com> Date: Tue, 10 Dec 2019 14:06:18 +0200 Subject: [PATCH 11/58] Customer reference (#11) --- library/Xi/Netvisor/Resource/Xml/SalesInvoice.php | 11 +++++++++++ tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php index 69d80c6..af61ccc 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php @@ -25,6 +25,7 @@ class SalesInvoice extends Root private $salesinvoicenumber; private $salesinvoicereferencenumber; private $salesinvoicefreetextafterlines; + private $salesinvoiceyourreference; /** * @XmlList(entry = "invoiceline") @@ -135,6 +136,16 @@ public function setAfterLinesText($text) return $this; } + /** + * @param string $text + * @return self + */ + public function setYourReference($text) + { + $this->salesinvoiceyourreference = $text; + return $this; + } + public function getDtdPath() { return $this->getDtdFile('salesinvoice.dtd'); diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php index 9d13746..e7c0881 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php @@ -144,4 +144,13 @@ public function testSetAfterLinesText() $xml = $this->toXml($this->invoice->getSerializableObject()); $this->assertXmlContainsTagWithValue('salesinvoicefreetextafterlines', $text, $xml); } + + public function testSetYourReference() + { + $text = 'Some reference data'; + + $this->invoice->setYourReference($text); + $xml = $this->toXml($this->invoice->getSerializableObject()); + $this->assertXmlContainsTagWithValue('salesinvoiceyourreference', $text, $xml); + } } From cb86dac4f00e6e758b23abf7c984161193bfca21 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Wed, 11 Dec 2019 08:34:28 +0200 Subject: [PATCH 12/58] Set variables to correct order --- .../Netvisor/Resource/Xml/CustomerBaseInformation.php | 2 +- library/Xi/Netvisor/Resource/Xml/SalesInvoice.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php b/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php index ffa9d0c..ddfc810 100644 --- a/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php +++ b/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php @@ -5,12 +5,12 @@ class CustomerBaseInformation { private $externalIdentifier; + private $organizationunitnumber; private $name; private $streetAddress; private $city; private $postNumber; private $country; - private $organizationunitnumber; private $phonenumber; private $email; private $isprivatecustomer = 0; diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php index af61ccc..e2c3ffa 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php @@ -12,20 +12,20 @@ */ class SalesInvoice extends Root { + private $salesinvoicenumber; private $salesInvoiceDate; + private $salesinvoicereferencenumber; private $salesInvoiceAmount; private $salesInvoiceStatus; + private $salesinvoicefreetextafterlines; + private $salesinvoiceyourreference; private $invoicingCustomerIdentifier; - private $paymentTermNetDays; private $deliveryaddressname; private $deliveryaddressline; private $deliveryaddresspostnumber; private $deliveryaddresstown; private $deliveryaddresscountrycode; - private $salesinvoicenumber; - private $salesinvoicereferencenumber; - private $salesinvoicefreetextafterlines; - private $salesinvoiceyourreference; + private $paymentTermNetDays; /** * @XmlList(entry = "invoiceline") From 56f01375d100716d1d1125f31277880b7dc97da7 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Wed, 11 Dec 2019 09:02:35 +0200 Subject: [PATCH 13/58] Bug fix on private customer --- .../Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php | 6 +++--- tests/Xi/Netvisor/Resource/Xml/CustomerTest.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php b/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php index ddfc810..99eb571 100644 --- a/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php +++ b/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php @@ -13,7 +13,7 @@ class CustomerBaseInformation private $country; private $phonenumber; private $email; - private $isprivatecustomer = 0; + private $isprivatecustomer = 1; /** * @param string $name @@ -73,11 +73,11 @@ public function setEmail($email) public function setBusinessId($id) { $this->externalIdentifier = null; - $this->isprivatecustomer = 0; + $this->isprivatecustomer = 1; if ($id) { $this->externalIdentifier = $id; - $this->isprivatecustomer = 1; + $this->isprivatecustomer = 0; } return $this; diff --git a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php index 285e66c..4bba2d8 100644 --- a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php @@ -91,12 +91,12 @@ public function testSetBusinessId($id) if (!$id) { $this->assertXmlDoesNotContainTag('externalidentifier', $xml); - $this->assertXmlContainsTagWithValue('isprivatecustomer', 0, $xml); + $this->assertXmlContainsTagWithValue('isprivatecustomer', 1, $xml); return; } $this->assertXmlContainsTagWithValue('externalidentifier', $id, $xml); - $this->assertXmlContainsTagWithValue('isprivatecustomer', 1, $xml); + $this->assertXmlContainsTagWithValue('isprivatecustomer', 0, $xml); } public function businessIdProvider() From 7e215165bb97e26d631773087e65e32d796db9d2 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Wed, 11 Dec 2019 09:20:04 +0200 Subject: [PATCH 14/58] Editable product identiefier type --- .../Resource/Xml/SalesInvoiceProductLine.php | 19 +++++++++- .../Xml/SalesInvoiceProductLineTest.php | 38 ++++++++++++++++++- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php index bafa7b8..88c28e1 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php @@ -7,6 +7,8 @@ class SalesInvoiceProductLine { + const PRODUCT_IDENTIFIER_TYPE_CUSTOMER = 'customer'; + const PRODUCT_IDENTIFIER_TYPE_NETVISOR = 'netvisor'; const UNIT_PRICE_TYPE_WITH_VAT = 'gross'; const UNIT_PRICE_TYPE_WITHOUT_VAT = 'net'; @@ -36,7 +38,11 @@ public function __construct( $productVatPercentage, $salesInvoiceProductLineQuantity ) { - $this->productIdentifier = new AttributeElement($productIdentifier, array('type' => 'netvisor')); // TODO: netvisor/customer. + $this->productIdentifier = new AttributeElement( + $productIdentifier, + array('type' => self::PRODUCT_IDENTIFIER_TYPE_NETVISOR) + ); + $this->productName = substr($productName, 0, 50); $this->productUnitPrice = new AttributeElement( @@ -58,6 +64,17 @@ public function addDimension($name, $item) return $this; } + /** + * @param string $name + * @param string $item + * @return self + */ + public function setProductIdentiefierType($type) + { + $this->productIdentifier->setAttribute('type', $type); + return $this; + } + /** * @param string $name * @param string $item diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 517627b..1a71f52 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -69,15 +69,49 @@ public function xmlHasAddedDimensionLines() $this->assertContains($item, $xml); } + /** + * @dataProvider productIdentifierTypeProvider + */ + public function testSetProductIdentifierType($type) + { + // Default + $xml = $this->toXml($this->invoiceProductLine); + $this->assertXmlContainsTagWithAttributes( + 'productidentifier', + array('type' => SalesInvoiceProductLine::PRODUCT_IDENTIFIER_TYPE_NETVISOR), + $xml + ); + + // Setted value + $this->invoiceProductLine->setProductIdentiefierType($type); + $xml = $this->toXml($this->invoiceProductLine); + $this->assertXmlContainsTagWithAttributes('productidentifier', array('type' => $type), $xml); + } + + public function productIdentifierTypeProvider() + { + return [ + [SalesInvoiceProductLine::PRODUCT_IDENTIFIER_TYPE_CUSTOMER], + [SalesInvoiceProductLine::PRODUCT_IDENTIFIER_TYPE_NETVISOR], + ]; + } + /** * @dataProvider unitPriceTypeProvider */ public function testSetUnitPriceType($type) { - $this->invoiceProductLine->setUnitPriceType($type); - + // Default $xml = $this->toXml($this->invoiceProductLine); + $this->assertXmlContainsTagWithAttributes( + 'productunitprice', + array('type' => SalesInvoiceProductLine::UNIT_PRICE_TYPE_WITHOUT_VAT), + $xml + ); + // Setted value + $this->invoiceProductLine->setUnitPriceType($type); + $xml = $this->toXml($this->invoiceProductLine); $this->assertXmlContainsTagWithAttributes('productunitprice', array('type' => $type), $xml); } From 8544a56e8e084c6343e160dd8bef9c7e4d509462 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Wed, 11 Dec 2019 10:57:59 +0200 Subject: [PATCH 15/58] Product line accounting account --- .../Netvisor/Resource/Xml/SalesInvoiceProductLine.php | 11 +++++++++++ .../Resource/Xml/SalesInvoiceProductLineTest.php | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php index 88c28e1..bcf1cd5 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php @@ -18,6 +18,7 @@ class SalesInvoiceProductLine private $productVatPercentage; private $salesInvoiceProductLineQuantity; private $salesinvoiceproductlinefreetext; + private $accountingaccountsuggestion; /** * @XmlList(inline = true, entry = "dimension") @@ -95,4 +96,14 @@ public function setFreeText($text) $this->salesinvoiceproductlinefreetext = $text; return $this; } + + /** + * @param int $account + * @return self + */ + public function setAccountingAccount($account) + { + $this->accountingaccountsuggestion = $account; + return $this; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 1a71f52..99c2c38 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -132,4 +132,14 @@ public function testSetFreeText() $this->assertXmlContainsTagWithValue('salesinvoiceproductlinefreetext', $text, $xml); } + + public function testSetAccountingAccount() + { + $account = 2000; + $this->invoiceProductLine->setAccountingAccount($account); + + $xml = $this->toXml($this->invoiceProductLine); + + $this->assertXmlContainsTagWithValue('accountingaccountsuggestion', $account, $xml); + } } From eee888d2a35c5415167e418e71cc5d776b3cdaef Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Fri, 20 Dec 2019 12:04:36 +0200 Subject: [PATCH 16/58] Set vatcode and minor CS fixes --- .../Resource/Xml/SalesInvoiceProductLine.php | 31 ++++++++++++------ .../Xml/SalesInvoiceProductLineTest.php | 32 +++++++++++++++++++ 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php index bcf1cd5..c610321 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php @@ -7,10 +7,12 @@ class SalesInvoiceProductLine { - const PRODUCT_IDENTIFIER_TYPE_CUSTOMER = 'customer'; - const PRODUCT_IDENTIFIER_TYPE_NETVISOR = 'netvisor'; - const UNIT_PRICE_TYPE_WITH_VAT = 'gross'; - const UNIT_PRICE_TYPE_WITHOUT_VAT = 'net'; + public const PRODUCT_IDENTIFIER_TYPE_CUSTOMER = 'customer'; + public const PRODUCT_IDENTIFIER_TYPE_NETVISOR = 'netvisor'; + public const UNIT_PRICE_TYPE_WITH_VAT = 'gross'; + public const UNIT_PRICE_TYPE_WITHOUT_VAT = 'net'; + public const VAT_CODE_KOMY = 'KOMY'; + public const VAT_CODE_NONE = 'NONE'; private $productIdentifier; private $productName; @@ -50,7 +52,10 @@ public function __construct( $productUnitPrice, array('type' => self::UNIT_PRICE_TYPE_WITHOUT_VAT) ); - $this->productVatPercentage = new AttributeElement($productVatPercentage, array('vatcode' => 'KOMY')); // TODO: different values. + $this->productVatPercentage = new AttributeElement( + $productVatPercentage, array('vatcode' => static::VAT_CODE_KOMY) + ); + $this->salesInvoiceProductLineQuantity = $salesInvoiceProductLineQuantity; } @@ -66,8 +71,7 @@ public function addDimension($name, $item) } /** - * @param string $name - * @param string $item + * @param string $type * @return self */ public function setProductIdentiefierType($type) @@ -77,8 +81,7 @@ public function setProductIdentiefierType($type) } /** - * @param string $name - * @param string $item + * @param string $type * @return self */ public function setUnitPriceType($type) @@ -106,4 +109,14 @@ public function setAccountingAccount($account) $this->accountingaccountsuggestion = $account; return $this; } + + /** + * @param string $code + * @return self + */ + public function setVatCode($code) + { + $this->productVatPercentage->setAttribute('vatcode', $code); + return $this; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 99c2c38..3e45b4e 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -142,4 +142,36 @@ public function testSetAccountingAccount() $this->assertXmlContainsTagWithValue('accountingaccountsuggestion', $account, $xml); } + + /** + * @dataProvider setVatCodeProvider + */ + public function testSetVatCode($code) + { + // Default + $xml = $this->toXml($this->invoiceProductLine); + $this->assertXmlContainsTagWithAttributes( + 'productvatpercentage', + array('vatcode' => SalesInvoiceProductLine::VAT_CODE_KOMY), + $xml + ); + + // Setted value + $this->invoiceProductLine->setVatCode($code); + $xml = $this->toXml($this->invoiceProductLine); + + $this->assertXmlContainsTagWithAttributes( + 'productvatpercentage', + array('vatcode' => $code), + $xml + ); + } + + public function setVatCodeProvider() + { + return [ + [SalesInvoiceProductLine::VAT_CODE_KOMY], + [SalesInvoiceProductLine::VAT_CODE_NONE], + ]; + } } From a50b0ecf617b287ce4e2f0fa55286b71fb6339e3 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Wed, 8 Jan 2020 10:12:35 +0200 Subject: [PATCH 17/58] Voucher --- .../Xi/Netvisor/Resource/Dtd/accounting.dtd | 32 +++++ library/Xi/Netvisor/Resource/Xml/Voucher.php | 73 ++++++++++ .../Xi/Netvisor/Resource/Xml/VoucherLine.php | 61 +++++++++ .../Netvisor/Resource/Xml/VoucherLineTest.php | 126 ++++++++++++++++++ .../Xi/Netvisor/Resource/Xml/VoucherTest.php | 62 +++++++++ 5 files changed, 354 insertions(+) create mode 100644 library/Xi/Netvisor/Resource/Dtd/accounting.dtd create mode 100644 library/Xi/Netvisor/Resource/Xml/Voucher.php create mode 100644 library/Xi/Netvisor/Resource/Xml/VoucherLine.php create mode 100644 tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php create mode 100644 tests/Xi/Netvisor/Resource/Xml/VoucherTest.php diff --git a/library/Xi/Netvisor/Resource/Dtd/accounting.dtd b/library/Xi/Netvisor/Resource/Dtd/accounting.dtd new file mode 100644 index 0000000..d0c8429 --- /dev/null +++ b/library/Xi/Netvisor/Resource/Dtd/accounting.dtd @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> diff --git a/library/Xi/Netvisor/Resource/Xml/Voucher.php b/library/Xi/Netvisor/Resource/Xml/Voucher.php new file mode 100644 index 0000000..d14cb8a --- /dev/null +++ b/library/Xi/Netvisor/Resource/Xml/Voucher.php @@ -0,0 +1,73 @@ +voucherClass = $voucherClass; + $this->calculationMode = $calculationMode; + $this->voucherDate = new AttributeElement($voucherDate->format('Y-m-d'), array('format' => 'ansi')); + } + + /** + * @param VoucherLine $line + * @return self + */ + public function addVoucherLine(VoucherLine $line) + { + $this->voucherLines[] = $line; + return $this; + } + + /** + * @param string $number + * @return self + */ + public function setNumber($number) + { + $this->number = $number; + return $this; + } + + /** + * @return string + */ + public function getDtdPath() + { + return $this->getDtdFile('accounting.dtd'); + } + + /** + * @return string + */ + protected function getXmlName() + { + return 'voucher'; + } +} diff --git a/library/Xi/Netvisor/Resource/Xml/VoucherLine.php b/library/Xi/Netvisor/Resource/Xml/VoucherLine.php new file mode 100644 index 0000000..015e2e6 --- /dev/null +++ b/library/Xi/Netvisor/Resource/Xml/VoucherLine.php @@ -0,0 +1,61 @@ +lineSum = new AttributeElement($lineSum, array('type' => self::UNIT_PRICE_TYPE_WITHOUT_VAT)); + $this->accountNumber = $accountNumber; + $this->vatPercent = new AttributeElement($vatPercent, array('vatcode' => static::VAT_CODE_KOMY)); + } + + /** + * @param string $name + * @param string $item + * @return self + */ + public function addDimension($name, $item) + { + $this->dimensions[] = new Dimension($name, $item); + return $this; + } + + /** + * @param string $type + * @return self + */ + public function setLineSumType($type) + { + $this->lineSum->setAttribute('type', $type); + return $this; + } + + /** + * @param string $code + * @return self + */ + public function setVatCode($code) + { + $this->vatPercent->setAttribute('vatcode', $code); + return $this; + } +} diff --git a/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php b/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php new file mode 100644 index 0000000..e770a41 --- /dev/null +++ b/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php @@ -0,0 +1,126 @@ +voucherLine = new VoucherLine(0, 0, 0); + } + + public function testXmlHasRequiredValues() + { + $lineSum = 123; + $account = 321; + $vatPercent = 24; + + $voucherLine = new VoucherLine($lineSum, $account, $vatPercent); + + $xml = $this->toXml($voucherLine); + + $this->assertXmlContainsTagWithValue('linesum', $lineSum, $xml); + $this->assertXmlContainsTagWithAttributes( + 'linesum', + array('type' => VoucherLine::UNIT_PRICE_TYPE_WITHOUT_VAT), + $xml + ); + + $this->assertXmlContainsTagWithValue('accountnumber', $account, $xml); + + $this->assertXmlContainsTagWithValue('vatpercent', $vatPercent, $xml); + $this->assertXmlContainsTagWithAttributes( + 'vatpercent', + array('vatcode' => VoucherLine::VAT_CODE_KOMY), + $xml + ); + } + + public function testXmlHasAddedDimensionLines() + { + $name = 'Test dimension name'; + $item = 'Test dimension item'; + $name2 = 'Another test dimension name'; + $item2 = 'Another test dimension item'; + + $this->voucherLine->addDimension($name, $item); + $this->voucherLine->addDimension($name2, $item2); + + $xml = $this->toXml($this->voucherLine); + + $this->assertSame(2, substr_count($xml, '')); + $this->assertContains($name, $xml); + $this->assertContains($item, $xml); + $this->assertContains($name2, $xml); + $this->assertContains($item, $xml); + } + + /** + * @dataProvider lineSumTypeProvider + */ + public function testSetLineSumType($type) + { + // Default + $xml = $this->toXml($this->voucherLine); + $this->assertXmlContainsTagWithAttributes( + 'linesum', + array('type' => VoucherLine::UNIT_PRICE_TYPE_WITHOUT_VAT), + $xml + ); + + // Setted value + $this->voucherLine->setLineSumType($type); + $xml = $this->toXml($this->voucherLine); + $this->assertXmlContainsTagWithAttributes('linesum', array('type' => $type), $xml); + } + + public function lineSumTypeProvider() + { + return [ + [VoucherLine::UNIT_PRICE_TYPE_WITH_VAT], + [VoucherLine::UNIT_PRICE_TYPE_WITHOUT_VAT], + ]; + } + + /** + * @dataProvider setVatCodeProvider + */ + public function testSetVatCode($code) + { + // Default + $xml = $this->toXml($this->voucherLine); + $this->assertXmlContainsTagWithAttributes( + 'vatpercent', + array('vatcode' => VoucherLine::VAT_CODE_KOMY), + $xml + ); + + // Setted value + $this->voucherLine->setVatCode($code); + $xml = $this->toXml($this->voucherLine); + + $this->assertXmlContainsTagWithAttributes( + 'vatpercent', + array('vatcode' => $code), + $xml + ); + } + + public function setVatCodeProvider() + { + return [ + [VoucherLine::VAT_CODE_KOMY], + [VoucherLine::VAT_CODE_NONE], + ]; + } +} diff --git a/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php new file mode 100644 index 0000000..a1f5734 --- /dev/null +++ b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php @@ -0,0 +1,62 @@ +voucher = new Voucher('Myyntilasku', Voucher::CALCULATION_MODE_NET, new \DateTime()); + } + + public function testHasDtd() + { + $this->assertNotNull($this->voucher->getDtdPath()); + } + + public function testXmlHasRequiredValues() + { + $type = 'Myyntilasku'; + $mode = Voucher::CALCULATION_MODE_NET; + $date = new \DateTime(); + + $voucher = new Voucher($type, $mode, $date); + + $xml = $this->toXml($voucher->getSerializableObject()); + + $this->assertXmlContainsTagWithValue('voucherclass', $type, $xml); + $this->assertXmlContainsTagWithValue('calculationmode', $mode, $xml); + $this->assertXmlContainsTagWithAttributes('voucherdate', array('format' => 'ansi'), $xml); + } + + public function testXmlHasAddedVoucherLines() + { + $this->voucher->addVoucherLine(new VoucherLine(0, 0, 0)); + $this->voucher->addVoucherLine(new VoucherLine(100, 1, 24)); + + $xml = $this->toXml($this->voucher->getSerializableObject()); + + $this->assertContains('voucherline', $xml); + $this->assertXmlContainsTagWithValue('linesum', 0, $xml); + $this->assertSame(2, substr_count($xml, '')); + } + + public function testSetNumber() + { + $number = '0123456'; + + $this->voucher->setNumber($number); + $xml = $this->toXml($this->voucher->getSerializableObject()); + $this->assertXmlContainsTagWithValue('number', $number, $xml); + } +} From bc3be97e12e5bc65e8384fae5adf39b69d37ac3a Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Wed, 8 Jan 2020 10:41:57 +0200 Subject: [PATCH 18/58] Send voucher --- library/Xi/Netvisor/Netvisor.php | 10 ++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index d90c8d0..995e120 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -12,6 +12,7 @@ use JMS\Serializer\Serializer; use Xi\Netvisor\Resource\Xml\Customer; use Xi\Netvisor\Resource\Xml\SalesInvoice; +use Xi\Netvisor\Resource\Xml\Voucher; use Xi\Netvisor\Serializer\Naming\LowercaseNamingStrategy; /** @@ -97,6 +98,15 @@ public function sendCustomer(Customer $customer) return $this->requestWithBody($customer, 'customer', ['method' => 'add']); } + /** + * @param Voucher $voucher + * @return null|string + */ + public function sendVoucher(Voucher $voucher) + { + return $this->requestWithBody($voucher, 'accounting'); + } + /** * @param Customer $customer * @return null|string diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index a244f2b..8046f9b 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -7,6 +7,7 @@ use Xi\Netvisor\Config; use Xi\Netvisor\Resource\Xml\Customer; use Xi\Netvisor\Resource\Xml\SalesInvoice; +use Xi\Netvisor\Resource\Xml\Voucher; use GuzzleHttp\Client; use Xi\Netvisor\Resource\Xml\TestResource; use GuzzleHttp\Psr7\Response; @@ -185,4 +186,26 @@ public function testUpdateCustomer() $netvisorMock->updateCustomer($customerMock, $id); } + + public function testSendVoucher() + { + $voucherMock = $this + ->getMockBuilder(Voucher::class) + ->disableOriginalConstructor() + ->getMock(); + + // Mock requestWithBody + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['requestWithBody']) + ->getMock(); + + $netvisorMock + ->expects($this->once()) + ->method('requestWithBody') + ->with($voucherMock, 'accounting'); + + $netvisorMock->sendVoucher($voucherMock); + } } From 629ff0f10a27441bb418ac435580e00f9dc0663a Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Thu, 16 Jan 2020 14:34:33 +0200 Subject: [PATCH 19/58] Add discount percentage property for invoice product line --- .../Netvisor/Resource/Xml/SalesInvoiceProductLine.php | 11 +++++++++++ .../Resource/Xml/SalesInvoiceProductLineTest.php | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php index c610321..05786e8 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php @@ -19,6 +19,7 @@ class SalesInvoiceProductLine private $productUnitPrice; private $productVatPercentage; private $salesInvoiceProductLineQuantity; + private $salesInvoiceProductLineDiscountPercentage; private $salesinvoiceproductlinefreetext; private $accountingaccountsuggestion; @@ -119,4 +120,14 @@ public function setVatCode($code) $this->productVatPercentage->setAttribute('vatcode', $code); return $this; } + + /** + * @param float $discountPercentage + * @return self + */ + public function setDiscountPercentage($discountPercentage) + { + $this->salesInvoiceProductLineDiscountPercentage = $discountPercentage; + return $this; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 3e45b4e..32e260b 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -174,4 +174,14 @@ public function setVatCodeProvider() [SalesInvoiceProductLine::VAT_CODE_NONE], ]; } + + public function testSetDiscountPercentage() + { + $discountPercentage = 20; + $this->invoiceProductLine->setDiscountPercentage($discountPercentage); + + $xml = $this->toXml($this->invoiceProductLine); + + $this->assertXmlContainsTagWithValue('salesinvoiceproductlinediscountpercentage', $discountPercentage, $xml); + } } From ab71aea2139c2ac91b882aeba5f88bd5ebb04ec5 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Thu, 16 Jan 2020 14:37:08 +0200 Subject: [PATCH 20/58] More similar price type contant naming --- library/Xi/Netvisor/Resource/Xml/Voucher.php | 4 ++-- tests/Xi/Netvisor/Resource/Xml/VoucherTest.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/Voucher.php b/library/Xi/Netvisor/Resource/Xml/Voucher.php index d14cb8a..5a7106c 100644 --- a/library/Xi/Netvisor/Resource/Xml/Voucher.php +++ b/library/Xi/Netvisor/Resource/Xml/Voucher.php @@ -8,8 +8,8 @@ class Voucher extends Root { - public const CALCULATION_MODE_NET = 'net'; - public const CALCULATION_MODE_GROSS = 'gross'; + public const CALCULATION_MODE_WITHOUT_VAT = 'net'; + public const CALCULATION_MODE_WITH_VAT = 'gross'; private $calculationMode; private $voucherDate; diff --git a/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php index a1f5734..70afb99 100644 --- a/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php @@ -16,7 +16,7 @@ public function setUp() { parent::setUp(); - $this->voucher = new Voucher('Myyntilasku', Voucher::CALCULATION_MODE_NET, new \DateTime()); + $this->voucher = new Voucher('Myyntilasku', Voucher::CALCULATION_MODE_WITH_VAT, new \DateTime()); } public function testHasDtd() @@ -27,7 +27,7 @@ public function testHasDtd() public function testXmlHasRequiredValues() { $type = 'Myyntilasku'; - $mode = Voucher::CALCULATION_MODE_NET; + $mode = Voucher::CALCULATION_MODE_WITH_VAT; $date = new \DateTime(); $voucher = new Voucher($type, $mode, $date); From 4cc4d4a18c3d31032b26fa053644b3a7fc3856bf Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Mon, 27 Jan 2020 08:13:09 +0200 Subject: [PATCH 21/58] Add voucher line description --- library/Xi/Netvisor/Resource/Xml/VoucherLine.php | 11 +++++++++++ tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/VoucherLine.php b/library/Xi/Netvisor/Resource/Xml/VoucherLine.php index 015e2e6..c4f2ff7 100644 --- a/library/Xi/Netvisor/Resource/Xml/VoucherLine.php +++ b/library/Xi/Netvisor/Resource/Xml/VoucherLine.php @@ -13,6 +13,7 @@ class VoucherLine public const VAT_CODE_NONE = 'NONE'; private $lineSum; + private $description; private $accountNumber; private $vatPercent; @@ -58,4 +59,14 @@ public function setVatCode($code) $this->vatPercent->setAttribute('vatcode', $code); return $this; } + + /** + * @param string $description + * @return self + */ + public function setDescription($description) + { + $this->description = $description; + return $this; + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php b/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php index e770a41..0b7d63a 100644 --- a/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php @@ -123,4 +123,12 @@ public function setVatCodeProvider() [VoucherLine::VAT_CODE_NONE], ]; } + + public function testSetDescription() + { + $description = md5(time()); + $this->voucherLine->setDescription($description); + $xml = $this->toXml($this->voucherLine); + $this->assertXmlContainsTagWithValue('description', $description, $xml); + } } From f90d0aac7bb2a7d433f8d9e1d8bf04c0c193f1d4 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 28 Jan 2020 13:18:07 +0200 Subject: [PATCH 22/58] Add description to voucher --- library/Xi/Netvisor/Resource/Xml/Voucher.php | 11 +++++++++++ tests/Xi/Netvisor/Resource/Xml/VoucherTest.php | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/Voucher.php b/library/Xi/Netvisor/Resource/Xml/Voucher.php index 5a7106c..de7f034 100644 --- a/library/Xi/Netvisor/Resource/Xml/Voucher.php +++ b/library/Xi/Netvisor/Resource/Xml/Voucher.php @@ -14,6 +14,7 @@ class Voucher extends Root private $calculationMode; private $voucherDate; private $number; + private $description; private $voucherClass; /** @@ -55,6 +56,16 @@ public function setNumber($number) return $this; } + /** + * @param string $description + * @return self + */ + public function setDescription($description) + { + $this->description = $description; + return $this; + } + /** * @return string */ diff --git a/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php index 70afb99..18bbe5b 100644 --- a/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php @@ -59,4 +59,13 @@ public function testSetNumber() $xml = $this->toXml($this->voucher->getSerializableObject()); $this->assertXmlContainsTagWithValue('number', $number, $xml); } + + public function testSetDescription() + { + $description = 'Some description'; + + $this->voucher->setDescription($description); + $xml = $this->toXml($this->voucher->getSerializableObject()); + $this->assertXmlContainsTagWithValue('description', $description, $xml); + } } From 9552a4ca955f69e8b9c9a82f9acb5e843dffdf17 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Mon, 17 Feb 2020 09:49:23 +0200 Subject: [PATCH 23/58] Update product name / description limits --- .../Netvisor/Resource/Xml/SalesInvoiceProductLine.php | 2 +- library/Xi/Netvisor/Resource/Xml/VoucherLine.php | 2 +- .../Resource/Xml/SalesInvoiceProductLineTest.php | 7 ++++--- tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php | 11 +++++++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php index 05786e8..2915c93 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLine.php @@ -47,7 +47,7 @@ public function __construct( array('type' => self::PRODUCT_IDENTIFIER_TYPE_NETVISOR) ); - $this->productName = substr($productName, 0, 50); + $this->productName = substr($productName, 0, 200); $this->productUnitPrice = new AttributeElement( $productUnitPrice, array('type' => self::UNIT_PRICE_TYPE_WITHOUT_VAT) diff --git a/library/Xi/Netvisor/Resource/Xml/VoucherLine.php b/library/Xi/Netvisor/Resource/Xml/VoucherLine.php index c4f2ff7..4e3aa73 100644 --- a/library/Xi/Netvisor/Resource/Xml/VoucherLine.php +++ b/library/Xi/Netvisor/Resource/Xml/VoucherLine.php @@ -66,7 +66,7 @@ public function setVatCode($code) */ public function setDescription($description) { - $this->description = $description; + $this->description = substr($description, 0, 255); return $this; } } diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 32e260b..076a237 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -7,6 +7,7 @@ class SalesInvoiceProductLineTest extends XmlTestCase { + private const LONG_PRODUCT_NAmE = 'Product name, which is longer than the limit of 200 characters Will add some lirum larum. Will add some lirum larum. Will add some lirum larum. Will add some lirum larum. Will add some lirum larum. Will add some lirum larum.'; /** * @var SalesInvoiceProductLine */ @@ -18,7 +19,7 @@ public function setUp() $this->invoiceProductLine = new SalesInvoiceProductLine( '100', - 'Product name, which is longer than the limit of 50 characters', + static::LONG_PRODUCT_NAmE, '1,23', '24', '5' @@ -35,8 +36,8 @@ public function xmlHasRequiredProductLineValues() $this->assertXmlContainsTagWithValue('productidentifier', '100', $xml); $this->assertXmlContainsTagWithAttributes('productidentifier', array('type' => 'netvisor'), $xml); - $this->assertXmlContainsTagWithValue('productname', 'Product name, which is longer than the limit of 50', $xml); - $this->assertNotContains('Product name, which is longer than the limit of 50 characters', $xml); + $this->assertXmlContainsTagWithValue('productname', substr(static::LONG_PRODUCT_NAmE, 0, 200), $xml); + $this->assertNotContains(static::LONG_PRODUCT_NAmE, $xml); $this->assertXmlContainsTagWithValue('productunitprice', '1,23', $xml); $this->assertXmlContainsTagWithAttributes('productunitprice', array('type' => 'net'), $xml); diff --git a/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php b/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php index 0b7d63a..b3b3c3d 100644 --- a/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php @@ -130,5 +130,16 @@ public function testSetDescription() $this->voucherLine->setDescription($description); $xml = $this->toXml($this->voucherLine); $this->assertXmlContainsTagWithValue('description', $description, $xml); + + // Test max length + while (strlen($description) <= 255) { + $description .= $description; + } + + $this->voucherLine->setDescription($description); + $xml = $this->toXml($this->voucherLine); + + $this->assertXmlContainsTagWithValue('description', substr($description, 0, 255), $xml); + $this->assertNotContains($description, $xml); } } From 73b461376e3b5ee9a67eab12857791a75b6b57dc Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Mon, 17 Feb 2020 13:39:04 +0200 Subject: [PATCH 24/58] Cut salesinvoicefreetextafterlines according to netvisor limit --- library/Xi/Netvisor/Resource/Xml/SalesInvoice.php | 2 +- tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php index e2c3ffa..9499474 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php @@ -132,7 +132,7 @@ public function setReferenceNumber($referenceNumber) */ public function setAfterLinesText($text) { - $this->salesinvoicefreetextafterlines = $text; + $this->salesinvoicefreetextafterlines = substr($text, 0, 500); return $this; } diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php index e7c0881..845c4a3 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php @@ -143,6 +143,17 @@ public function testSetAfterLinesText() $this->invoice->setAfterLinesText($text); $xml = $this->toXml($this->invoice->getSerializableObject()); $this->assertXmlContainsTagWithValue('salesinvoicefreetextafterlines', $text, $xml); + + // Too long + while (strlen($text) <= 500) { + $text .= $text; + } + + $this->invoice->setAfterLinesText($text); + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $this->assertXmlContainsTagWithValue('salesinvoicefreetextafterlines', substr($text, 0, 500), $xml); + $this->assertNotContains($text, $xml); } public function testSetYourReference() From 2a8ab9cb0deba968be2f1d6e5640b70b052acd53 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Thu, 20 Feb 2020 12:02:32 +0200 Subject: [PATCH 25/58] SalesInvoice getter --- library/Xi/Netvisor/Netvisor.php | 18 +++++++++++++++++- tests/Xi/Netvisor/NetvisorTest.php | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 995e120..fed28fd 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -176,12 +176,28 @@ public function getProduct($id) ); } + /** + * Get details for a invoice identified by Netvisor id. + * + * @param int $id + * @return null|string + */ + public function getSalesInvoice($id) + { + return $this->get( + 'getsalesinvoice', + [ + 'id' => $id, + ] + ); + } + /** * @param string $service * @param array $params * @return null|string */ - private function get($service, array $params = []) + protected function get($service, array $params = []) { if (!$this->config->isEnabled()) { return null; diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 8046f9b..3ff4bf1 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -208,4 +208,23 @@ public function testSendVoucher() $netvisorMock->sendVoucher($voucherMock); } + + public function testGetSalesInvoice() + { + $id = 1234564; + + // @var Netvisor $netvisorMock + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['get']) + ->getMock(); + + $netvisorMock + ->expects($this->once()) + ->method('get') + ->with('getsalesinvoice', ['id' => $id]); + + $netvisorMock->getSalesInvoice($id); + } } From d57d232a54885d9cc111f63540fda49644833996 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Thu, 20 Feb 2020 12:13:14 +0200 Subject: [PATCH 26/58] Fix param name for getting sales invoice --- library/Xi/Netvisor/Netvisor.php | 2 +- tests/Xi/Netvisor/NetvisorTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index fed28fd..09459be 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -187,7 +187,7 @@ public function getSalesInvoice($id) return $this->get( 'getsalesinvoice', [ - 'id' => $id, + 'netvisorkey' => $id, ] ); } diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 3ff4bf1..c2b97ea 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -223,7 +223,7 @@ public function testGetSalesInvoice() $netvisorMock ->expects($this->once()) ->method('get') - ->with('getsalesinvoice', ['id' => $id]); + ->with('getsalesinvoice', ['netvisorkey' => $id]); $netvisorMock->getSalesInvoice($id); } From 2ee16af00fd1e45a39c2e93b9bd7d57d1a6726e9 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Thu, 20 Feb 2020 13:03:02 +0200 Subject: [PATCH 27/58] Ability to set beforelines text on sales invoice --- .../Xi/Netvisor/Resource/Xml/SalesInvoice.php | 11 ++++++++++ .../Resource/Xml/SalesInvoiceTest.php | 20 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php index 9499474..e814ab4 100644 --- a/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/SalesInvoice.php @@ -17,6 +17,7 @@ class SalesInvoice extends Root private $salesinvoicereferencenumber; private $salesInvoiceAmount; private $salesInvoiceStatus; + private $salesinvoicefreetextbeforelines; private $salesinvoicefreetextafterlines; private $salesinvoiceyourreference; private $invoicingCustomerIdentifier; @@ -136,6 +137,16 @@ public function setAfterLinesText($text) return $this; } + /** + * @param string $text + * @return self + */ + public function setBeforeLinesText($text) + { + $this->salesinvoicefreetextbeforelines = substr($text, 0, 500); + return $this; + } + /** * @param string $text * @return self diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php index 845c4a3..97c5789 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php @@ -136,6 +136,26 @@ public function testSetReferenceNumber() ); } + public function testSetBeforeLinesText() + { + $text = 'Some additional data'; + + $this->invoice->setBeforeLinesText($text); + $xml = $this->toXml($this->invoice->getSerializableObject()); + $this->assertXmlContainsTagWithValue('salesinvoicefreetextbeforelines', $text, $xml); + + // Too long + while (strlen($text) <= 500) { + $text .= $text; + } + + $this->invoice->setBeforeLinesText($text); + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $this->assertXmlContainsTagWithValue('salesinvoicefreetextbeforelines', substr($text, 0, 500), $xml); + $this->assertNotContains($text, $xml); + } + public function testSetAfterLinesText() { $text = 'Some additional data'; From 14e28013ac87660f13c69767383c00ffd783ab4a Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Fri, 21 Feb 2020 09:15:38 +0200 Subject: [PATCH 28/58] Ability to update sales invoice --- library/Xi/Netvisor/Netvisor.php | 18 ++++++++++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 30 ++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 09459be..4be316f 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -109,6 +109,7 @@ public function sendVoucher(Voucher $voucher) /** * @param Customer $customer + * @param int $id * @return null|string */ public function updateCustomer(Customer $customer, int $id) @@ -123,6 +124,23 @@ public function updateCustomer(Customer $customer, int $id) ); } + /** + * @param SalesInvoice $invoice + * @param int $id + * @return null|string + */ + public function updateInvoice(SalesInvoice $invoice, int $id) + { + return $this->requestWithBody( + $invoice, + 'salesinvoice', + [ + 'method' => 'edit', + 'id' => $id, + ] + ); + } + /** * List customers, optionally filtered by a keyword. * diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index c2b97ea..8c42e85 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -187,6 +187,36 @@ public function testUpdateCustomer() $netvisorMock->updateCustomer($customerMock, $id); } + public function testUpdateInvoice() + { + // Expected params + $id = 12345; + + $attributes = [ + 'method' => 'edit', + 'id' => $id, + ]; + + $invoiceMock = $this + ->getMockBuilder(SalesInvoice::class) + ->disableOriginalConstructor() + ->getMock(); + + // Mock requestWithBody + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['requestWithBody']) + ->getMock(); + + $netvisorMock + ->expects($this->once()) + ->method('requestWithBody') + ->with($invoiceMock, 'salesinvoice', $attributes); + + $netvisorMock->updateInvoice($invoiceMock, $id); + } + public function testSendVoucher() { $voucherMock = $this From cf8b30705639400662fb9b73c419ee9ed74dc1cd Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Fri, 21 Feb 2020 12:31:11 +0200 Subject: [PATCH 29/58] Ability to get vouchers --- library/Xi/Netvisor/Netvisor.php | 18 ++++++++++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 26 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 4be316f..3d29514 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -210,6 +210,24 @@ public function getSalesInvoice($id) ); } + /** + * Get vouchers by timeframe + * + * @param DateTime $startDate + * @param DateTime $endDate + * @return null|string + */ + public function getVouchers(\DateTime $startDate, \DateTime $endDate) + { + return $this->get( + 'accountingledger', + [ + 'startdate' => $startDate->format('Y-m-d'), + 'enddate' => $endDate->format('Y-m-d'), + ] + ); + } + /** * @param string $service * @param array $params diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 8c42e85..28ddf17 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -257,4 +257,30 @@ public function testGetSalesInvoice() $netvisorMock->getSalesInvoice($id); } + + public function testGetVouchers() + { + $start = new \DateTime('2000-01-01'); + $end = new \DateTime('2001-01-01'); + + // @var Netvisor $netvisorMock + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['get']) + ->getMock(); + + $netvisorMock + ->expects($this->once()) + ->method('get') + ->with( + 'accountingledger', + [ + 'startdate' => $start->format('Y-m-d'), + 'enddate' => $end->format('Y-m-d'), + ] + ); + + $netvisorMock->getVouchers($start, $end); + } } From 887304b9f1bf7c99f983d0a62544d92d21a85169 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Fri, 21 Feb 2020 12:31:22 +0200 Subject: [PATCH 30/58] Ability to get certain voucher --- library/Xi/Netvisor/Netvisor.php | 21 +++++++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 42 ++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 3d29514..58751bf 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -228,6 +228,27 @@ public function getVouchers(\DateTime $startDate, \DateTime $endDate) ); } + /** + * Get details for a certain voucher from timeframe identified by Netvisor id. + * + * @param int $id + * @param DateTime $startDate + * @param DateTime $endDate + * @return null|string + */ + public function getVoucher($id, \DateTime $startDate, \DateTime $endDate) + { + $response = new \SimpleXMLElement($this->getVouchers($startDate, $endDate)); + + foreach ($response->vouchers->children() as $voucher) { + if ((int) $voucher->netvisorkey === (int) $id) { + return $voucher->asXml(); + } + } + + return null; + } + /** * @param string $service * @param array $params diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 28ddf17..be2fa05 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -283,4 +283,46 @@ public function testGetVouchers() $netvisorMock->getVouchers($start, $end); } + + public function testGetVoucher() + { + $id = 12345; + $start = new \DateTime('2000-01-01'); + $end = new \DateTime('2001-01-01'); + + // @var Netvisor $netvisorMock + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['getVouchers']) + ->getMock(); + + $netvisorMock + ->method('getVouchers') + ->willReturn(' + + + + + 54321 + + + + + ' . $id . ' + + + + '); + + // Not found + $result = $netvisorMock->getVoucher(999, $start, $end); + $this->assertNull($result); + + // Found + $result = $netvisorMock->getVoucher($id, $start, $end); + $voucher = new \SimpleXMLElement($result); + + $this->assertSame((int) $voucher->netvisorkey, $id); + } } From 1ce089159f267aceabb3fff03fc5f7ac0b7554e4 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Fri, 21 Feb 2020 13:46:34 +0200 Subject: [PATCH 31/58] Change to pascalcase as it actually is, unlike in the netvisor documentation --- library/Xi/Netvisor/Netvisor.php | 4 ++-- tests/Xi/Netvisor/NetvisorTest.php | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 58751bf..583cb1e 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -240,8 +240,8 @@ public function getVoucher($id, \DateTime $startDate, \DateTime $endDate) { $response = new \SimpleXMLElement($this->getVouchers($startDate, $endDate)); - foreach ($response->vouchers->children() as $voucher) { - if ((int) $voucher->netvisorkey === (int) $id) { + foreach ($response->Vouchers->children() as $voucher) { + if ((int) $voucher->NetvisorKey === (int) $id) { return $voucher->asXml(); } } diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index be2fa05..7a17414 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -301,18 +301,18 @@ public function testGetVoucher() ->method('getVouchers') ->willReturn(' - - - + + + 54321 - - - - + + + + ' . $id . ' - - - + + + '); // Not found @@ -323,6 +323,6 @@ public function testGetVoucher() $result = $netvisorMock->getVoucher($id, $start, $end); $voucher = new \SimpleXMLElement($result); - $this->assertSame((int) $voucher->netvisorkey, $id); + $this->assertSame((int) $voucher->NetvisorKey, $id); } } From 7415389162120e5bccb9dbf56a8e40f60cadf88d Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 25 Feb 2020 09:09:48 +0200 Subject: [PATCH 32/58] Purchase invoice dtd --- .../Netvisor/Resource/Dtd/purchaseinvoice.dtd | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 library/Xi/Netvisor/Resource/Dtd/purchaseinvoice.dtd diff --git a/library/Xi/Netvisor/Resource/Dtd/purchaseinvoice.dtd b/library/Xi/Netvisor/Resource/Dtd/purchaseinvoice.dtd new file mode 100644 index 0000000..36b4f37 --- /dev/null +++ b/library/Xi/Netvisor/Resource/Dtd/purchaseinvoice.dtd @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From ce03a93001783e6696f99e3eb8e58e2d57141f60 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 25 Feb 2020 09:09:58 +0200 Subject: [PATCH 33/58] Fix test helper --- tests/Xi/Netvisor/XmlTestCase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Xi/Netvisor/XmlTestCase.php b/tests/Xi/Netvisor/XmlTestCase.php index b3a3eef..0c4af3e 100644 --- a/tests/Xi/Netvisor/XmlTestCase.php +++ b/tests/Xi/Netvisor/XmlTestCase.php @@ -39,7 +39,7 @@ public function assertXmlContainsTagWithValue($tag, $value, $xml) { $this->assertContains(sprintf('<%s', $tag), $xml); - if (is_int($value)) { + if (is_int($value) || is_float($value)) { $this->assertContains(sprintf('>%s', $value, $tag), $xml); return; } From 8d6a220c50ba8778d91a4202fbcf5f44ad425f46 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 25 Feb 2020 09:43:54 +0200 Subject: [PATCH 34/58] Purchase invoice line --- .../Resource/Xml/PurchaseInvoiceLine.php | 66 +++++++++++++ .../Resource/Xml/PurchaseInvoiceLineTest.php | 92 +++++++++++++++++++ 2 files changed, 158 insertions(+) create mode 100644 library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLine.php create mode 100644 tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLineTest.php diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLine.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLine.php new file mode 100644 index 0000000..856391c --- /dev/null +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLine.php @@ -0,0 +1,66 @@ +productname = substr($productName, 0, 200); + $this->deliveredamount = $deliveredAmount; + $this->unitprice = $unitPrice; + $this->vatpercent = $vatPercent; + + $this->linesum = new AttributeElement( + round($lineSum, 2), array('type' => 'brutto') + ); + } + + /** + * @param string $name + * @param string $item + * @return self + */ + public function addDimension($name, $item) + { + $this->dimensions[] = new Dimension($name, $item); + return $this; + } + + /** + * @param int $account + * @return self + */ + public function setAccountingAccount($account) + { + $this->accountingsuggestion = $account; + return $this; + } +} diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLineTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLineTest.php new file mode 100644 index 0000000..a315881 --- /dev/null +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLineTest.php @@ -0,0 +1,92 @@ +invoiceLine = new PurchaseInvoiceLine( + '100', + 'Name', + '1,23', + '24', + '5' + ); + } + + /** + * @test + */ + public function xmlHasRequiredLineValues() + { + $name = 'Product name, which is longer than the limit of 200 characters Will add some lirum larum. Will add some lirum larum. Will add some lirum larum. Will add some lirum larum. Will add some lirum larum. Will add some lirum larum.'; + $amount = 2; + $unitPrice = 10; + $vatPercent = 24; + $lineSum = 100.456; + + $xml = $this->toXml( + new PurchaseInvoiceLine( + $name, + $amount, + $unitPrice, + $vatPercent, + $lineSum + ) + ); + + $this->assertXmlContainsTagWithValue('productname', substr($name, 0, 200), $xml); + $this->assertNotContains($name, $xml); + + $this->assertXmlContainsTagWithValue('deliveredamount', $amount, $xml); + $this->assertXmlContainsTagWithValue('unitprice', $unitPrice, $xml); + $this->assertXmlContainsTagWithValue('vatpercent', $vatPercent, $xml); + + $this->assertXmlContainsTagWithValue('linesum', round($lineSum, 2), $xml); + $this->assertNotContains((string) $lineSum, $xml); + $this->assertXmlContainsTagWithAttributes('linesum', array('type' => 'brutto'), $xml); + } + + /** + * @test + */ + public function xmlHasAddedDimensionLines() + { + $name = 'Test dimension name'; + $item = 'Test dimension item'; + $name2 = 'Another test dimension name'; + $item2 = 'Another test dimension item'; + + $this->invoiceLine->addDimension($name, $item); + $this->invoiceLine->addDimension($name2, $item2); + + $xml = $this->toXml($this->invoiceLine); + + $this->assertSame(2, substr_count($xml, '')); + $this->assertContains($name, $xml); + $this->assertContains($item, $xml); + $this->assertContains($name2, $xml); + $this->assertContains($item, $xml); + } + + public function testSetAccountingAccount() + { + $account = 3000; + $this->invoiceLine->setAccountingAccount($account); + + $xml = $this->toXml($this->invoiceLine); + + $this->assertXmlContainsTagWithValue('accountingsuggestion', $account, $xml); + } +} From 29f84e60e75f11848ab82af93dbf6b8ce567aa7d Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 25 Feb 2020 09:44:37 +0200 Subject: [PATCH 35/58] Purchase invoice --- .../Netvisor/Resource/Xml/PurchaseInvoice.php | 88 ++++++++++++++ .../Resource/Xml/PurchaseInvoiceTest.php | 113 ++++++++++++++++++ 2 files changed, 201 insertions(+) create mode 100644 library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php create mode 100644 tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php new file mode 100644 index 0000000..25c69d6 --- /dev/null +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php @@ -0,0 +1,88 @@ +invoicenumber = $invoiceNumber; + $this->amount = round($amount, 2); + + $this->invoicedate = new AttributeElement( + $invoiceDate->format('Y-m-d'), + array('format' => 'ansi') + ); + + $this->valuedate = new AttributeElement( + $valueDate->format('Y-m-d'), + array('format' => 'ansi') + ); + + $this->duedate = new AttributeElement( + $dueDate->format('Y-m-d'), + array('format' => 'ansi') + ); + } + + /** + * @param PurchaseInvoiceLine $line + * @return self + */ + public function addPurchaseInvoiceLine(PurchaseInvoiceLine $line) + { + $this->purchaseinvoicelines[] = new WrapperElement('purchaseinvoiceline', $line); + return $this; + } + + /** + * @param string $comment + * @return self + */ + public function setComment($comment) + { + $this->comment = substr($comment, 0, 255); + return $this; + } + + public function getDtdPath() + { + return $this->getDtdFile('purchaseinvoice.dtd'); + } + + protected function getXmlName() + { + return 'purchaseinvoice'; + } +} diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php new file mode 100644 index 0000000..325d9d9 --- /dev/null +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php @@ -0,0 +1,113 @@ +invoice = new PurchaseInvoice( + 123, + new \DateTime(), + new \DateTime(), + new \DateTime(), + 321 + ); + } + + /** + * @test + */ + public function hasDtd() + { + $this->assertNotNull($this->invoice->getDtdPath()); + } + + /** + * @test + */ + public function xmlHasRequiredSalesInvoiceValues() + { + $invoiceNumber = 123; + $invoiceDate = new \DateTime('2000-01-01'); + $valueDate = new \DateTime('2001-01-01'); + $dueDate = new \DateTime('2001-01-01'); + $amount = 321.278; + + $invoice = new PurchaseInvoice( + $invoiceNumber, + $invoiceDate, + $valueDate, + $dueDate, + $amount + ); + + $xml = $this->toXml($invoice->getSerializableObject()); + + $this->assertXmlContainsTagWithValue('invoicenumber', $invoiceNumber, $xml); + + $this->assertXmlContainsTagWithValue('invoicedate', $invoiceDate->format('Y-m-d'), $xml); + $this->assertXmlContainsTagWithAttributes('invoicedate', array('format' => 'ansi'), $xml); + + $this->assertXmlContainsTagWithValue('valuedate', $valueDate->format('Y-m-d'), $xml); + $this->assertXmlContainsTagWithAttributes('valuedate', array('format' => 'ansi'), $xml); + + $this->assertXmlContainsTagWithValue('duedate', $dueDate->format('Y-m-d'), $xml); + $this->assertXmlContainsTagWithAttributes('duedate', array('format' => 'ansi'), $xml); + + $this->assertXmlContainsTagWithValue('amount', round($amount, 2), $xml); + $this->assertNotContains((string) $amount, $xml); + } + + /** + * @test + */ + public function xmlHasAddedPurchaseInvoiceLines() + { + $this->invoice->addPurchaseInvoiceLine( + new PurchaseInvoiceLine('Name 1', 1, 1, 24, 1.24) + ); + + $this->invoice->addPurchaseInvoiceLine( + new PurchaseInvoiceLine('Name 2', 2, 2, 24, 4.96) + ); + + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $this->assertContains('purchaseinvoicelines', $xml); + $this->assertContains('purchaseinvoiceline', $xml); + + $this->assertXmlContainsTagWithValue('productname', 'Name 1', $xml); + $this->assertXmlContainsTagWithValue('productname', 'Name 2', $xml); + } + + public function testSetComment() + { + $comment = 'Some additional data'; + + $this->invoice->setComment($comment); + $xml = $this->toXml($this->invoice->getSerializableObject()); + $this->assertXmlContainsTagWithValue('comment', $comment, $xml); + + // Too long + while (strlen($comment) <= 255) { + $comment .= $comment; + } + + $this->invoice->setComment($comment); + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $this->assertXmlContainsTagWithValue('comment', substr($comment, 0, 255), $xml); + $this->assertNotContains($comment, $xml); + } +} From 3a67800c4a9c5af8c342594bbe0e90c260698fe1 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 25 Feb 2020 10:24:20 +0200 Subject: [PATCH 36/58] Ability to send purchase invoice --- library/Xi/Netvisor/Netvisor.php | 10 ++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 23 +++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 583cb1e..e0e974b 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -12,6 +12,7 @@ use JMS\Serializer\Serializer; use Xi\Netvisor\Resource\Xml\Customer; use Xi\Netvisor\Resource\Xml\SalesInvoice; +use Xi\Netvisor\Resource\Xml\PurchaseInvoice; use Xi\Netvisor\Resource\Xml\Voucher; use Xi\Netvisor\Serializer\Naming\LowercaseNamingStrategy; @@ -107,6 +108,15 @@ public function sendVoucher(Voucher $voucher) return $this->requestWithBody($voucher, 'accounting'); } + /** + * @param PurchaseInvoice $invoice + * @return null|string + */ + public function sendPurchaseInvoice(PurchaseInvoice $invoice) + { + return $this->requestWithBody($invoice, 'purchaseinvoice'); + } + /** * @param Customer $customer * @param int $id diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 7a17414..8ac4621 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -11,6 +11,7 @@ use GuzzleHttp\Client; use Xi\Netvisor\Resource\Xml\TestResource; use GuzzleHttp\Psr7\Response; +use Xi\Netvisor\Resource\Xml\PurchaseInvoice; class NetvisorTest extends \PHPUnit_Framework_TestCase { @@ -325,4 +326,26 @@ public function testGetVoucher() $this->assertSame((int) $voucher->NetvisorKey, $id); } + + public function testSendPurchaseInvoice() + { + $purchaseInvoiceMock = $this + ->getMockBuilder(PurchaseInvoice::class) + ->disableOriginalConstructor() + ->getMock(); + + // Mock requestWithBody + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['requestWithBody']) + ->getMock(); + + $netvisorMock + ->expects($this->once()) + ->method('requestWithBody') + ->with($purchaseInvoiceMock, 'purchaseinvoice'); + + $netvisorMock->sendPurchaseInvoice($purchaseInvoiceMock); + } } From b2cc43273779ad8fbaf7f5ee77cddd1179c420b0 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Wed, 26 Feb 2020 14:25:49 +0200 Subject: [PATCH 37/58] Add more data to purchase invoice --- .../Netvisor/Resource/Xml/PurchaseInvoice.php | 57 ++++++++ .../Resource/Xml/PurchaseInvoiceTest.php | 129 ++++++++++++++++++ 2 files changed, 186 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php index 25c69d6..50cb1d2 100644 --- a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php @@ -13,7 +13,17 @@ class PurchaseInvoice extends Root private $invoicedate; private $valuedate; private $duedate; + private $vendorname; + private $vendoraddressline; + private $vendorpostnumber; + private $vendorcity; + private $vendorcountry; + private $vendorphonenumber; + private $vendoremail; private $amount; + private $accountnumber; + private $organizationidentifier; + private $bankreferencenumber; private $comment; /** @@ -66,6 +76,53 @@ public function addPurchaseInvoiceLine(PurchaseInvoiceLine $line) return $this; } + /** + * @param string $bankAccount + * @param string $businessId + * @param string $name + * @param string $streetAddress + * @param string $postNumber + * @param string $city + * @param string $countryCode + * @param string $phone + * @param string $email + * + * @return self + */ + public function setVendorDetails( + $bankAccount = null, + $businessId = null, + $name = null, + $streetAddress = null, + $postNumber = null, + $city = null, + $countryCode = null, + $phone = null, + $email = null + ) { + $this->accountnumber = $bankAccount; + $this->organizationidentifier = $businessId; + $this->vendorname = $name ? substr($name, 0, 250) : $name; + $this->vendoraddressline = $streetAddress ? substr($streetAddress, 0, 80) : $streetAddress; + $this->vendorpostnumber = $postNumber ? substr($postNumber, 0, 50) : $postNumber; + $this->vendorcity = $city ? substr($city, 0, 50) : $city; + $this->vendorcountry = $countryCode ? substr($countryCode, 0, 2) : $countryCode; + $this->vendorphonenumber = $phone ? substr($phone, 0, 80) : $phone; + $this->vendoremail = $email ? substr($email, 0, 80) : $email; + + return $this; + } + + /** + * @param string $reference + * @return self + */ + public function setBankReferenceNumber($reference) + { + $this->bankreferencenumber = $reference; + return $this; + } + /** * @param string $comment * @return self diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php index 325d9d9..b57f6e5 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php @@ -110,4 +110,133 @@ public function testSetComment() $this->assertXmlContainsTagWithValue('comment', substr($comment, 0, 255), $xml); $this->assertNotContains($comment, $xml); } + + /** + * @dataProvider setVendorDetailsProvider + */ + public function testSetVendorDetails( + $bankAccount, + $businessId, + $name, + $streetAddress, + $postNumber, + $city, + $countryCode, + $phone, + $email + ) { + $this->invoice->setVendorDetails( + $bankAccount, + $businessId, + $name, + $streetAddress, + $postNumber, + $city, + $countryCode, + $phone, + $email + ); + + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $map = [ + 'accountnumber' => [ + 'value' => $bankAccount, + 'maxlength' => null, + ], + 'organizationidentifier' => [ + 'value' => $businessId, + 'maxlength' => null, + ], + 'vendorname' => [ + 'value' => $name, + 'maxlength' => 250, + ], + 'vendoraddressline' => [ + 'value' => $streetAddress, + 'maxlength' => 80, + ], + 'vendorpostnumber' => [ + 'value' => $postNumber, + 'maxlength' => 50, + ], + 'vendorcity' => [ + 'value' => $city, + 'maxlength' => 50, + ], + 'vendorcountry' => [ + 'value' => $countryCode, + 'maxlength' => 2, + ], + 'vendorphonenumber' => [ + 'value' => $phone, + 'maxlength' => 80, + ], + 'vendoremail' => [ + 'value' => $email, + 'maxlength' => 80, + ], + ]; + + foreach ($map as $key => $data) { + if (is_null($data['value'])) { + $this->assertXmlDoesNotContainTag($key, $xml); + continue; + } + + $value = !is_null($data['maxlength']) ? + substr($data['value'], 0, $data['maxlength']) : + $data['value']; + + $this->assertXmlContainsTagWithValue($key, $value, $xml); + } + } + + public function setVendorDetailsProvider() + { + return [ + [ + null, + null, + null, + null, + null, + null, + null, + null, + null, + ], + [ + '12315456', + '448414-4', + 'Vendor name', + 'Address 13', + '012345', + 'Vendor city', + 'FI', + '0501234567', + 'vendor@email.com', + ], + [ + str_repeat('1', 300), + str_repeat('1', 300), + str_repeat('1', 300), + str_repeat('1', 300), + str_repeat('1', 300), + str_repeat('1', 300), + str_repeat('1', 300), + str_repeat('1', 300), + str_repeat('1', 300), + ], + ]; + } + + public function testSetBankReferenceNumber() + { + $reference = '0123154891315'; + + $this->invoice->setBankReferenceNumber($reference); + $xml = $this->toXml($this->invoice->getSerializableObject()); + $this->assertXmlContainsTagWithValue('bankreferencenumber', $reference, $xml); + } } From 5188f02103ac476eedecc6d5419307172f558712 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Thu, 27 Feb 2020 08:27:49 +0200 Subject: [PATCH 38/58] Inturpit empty strings as nulls when adding vendor details --- .../Netvisor/Resource/Xml/PurchaseInvoice.php | 18 +++++++++--------- .../Resource/Xml/PurchaseInvoiceTest.php | 13 ++++++++++++- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php index 50cb1d2..4e32a86 100644 --- a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php @@ -100,15 +100,15 @@ public function setVendorDetails( $phone = null, $email = null ) { - $this->accountnumber = $bankAccount; - $this->organizationidentifier = $businessId; - $this->vendorname = $name ? substr($name, 0, 250) : $name; - $this->vendoraddressline = $streetAddress ? substr($streetAddress, 0, 80) : $streetAddress; - $this->vendorpostnumber = $postNumber ? substr($postNumber, 0, 50) : $postNumber; - $this->vendorcity = $city ? substr($city, 0, 50) : $city; - $this->vendorcountry = $countryCode ? substr($countryCode, 0, 2) : $countryCode; - $this->vendorphonenumber = $phone ? substr($phone, 0, 80) : $phone; - $this->vendoremail = $email ? substr($email, 0, 80) : $email; + $this->accountnumber = $bankAccount ?: null; + $this->organizationidentifier = $businessId ?: null; + $this->vendorname = $name ? substr($name, 0, 250) : null; + $this->vendoraddressline = $streetAddress ? substr($streetAddress, 0, 80) : null; + $this->vendorpostnumber = $postNumber ? substr($postNumber, 0, 50) : null; + $this->vendorcity = $city ? substr($city, 0, 50) : null; + $this->vendorcountry = $countryCode ? substr($countryCode, 0, 2) : null; + $this->vendorphonenumber = $phone ? substr($phone, 0, 80) : null; + $this->vendoremail = $email ? substr($email, 0, 80) : null; return $this; } diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php index b57f6e5..c83c6ea 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php @@ -179,7 +179,7 @@ public function testSetVendorDetails( ]; foreach ($map as $key => $data) { - if (is_null($data['value'])) { + if (!$data['value']) { $this->assertXmlDoesNotContainTag($key, $xml); continue; } @@ -206,6 +206,17 @@ public function setVendorDetailsProvider() null, null, ], + [ + '', + '', + '', + '', + '', + '', + '', + '', + '', + ], [ '12315456', '448414-4', From c5e5751b78a3d71abb14e585812617b59e24e41c Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 17 Mar 2020 15:03:18 +0200 Subject: [PATCH 39/58] Fix buggy dtd --- library/Xi/Netvisor/Resource/Dtd/purchaseinvoice.dtd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Dtd/purchaseinvoice.dtd b/library/Xi/Netvisor/Resource/Dtd/purchaseinvoice.dtd index 36b4f37..c5526e7 100644 --- a/library/Xi/Netvisor/Resource/Dtd/purchaseinvoice.dtd +++ b/library/Xi/Netvisor/Resource/Dtd/purchaseinvoice.dtd @@ -1,3 +1,4 @@ + @@ -73,3 +74,4 @@ +]> From 16764f451b33b16e11ab6ccbe340d3b6cdac8cdd Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 17 Mar 2020 15:03:33 +0200 Subject: [PATCH 40/58] Fix invalid relation --- library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php index 4e32a86..89b2124 100644 --- a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php @@ -72,7 +72,7 @@ public function __construct( */ public function addPurchaseInvoiceLine(PurchaseInvoiceLine $line) { - $this->purchaseinvoicelines[] = new WrapperElement('purchaseinvoiceline', $line); + $this->purchaseinvoicelines[] = $line; return $this; } From 41dbb635638cd2e63c8511fc95944845193e3525 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 17 Mar 2020 15:03:55 +0200 Subject: [PATCH 41/58] Assertion to validate xml validity --- tests/Xi/Netvisor/XmlTestCase.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/Xi/Netvisor/XmlTestCase.php b/tests/Xi/Netvisor/XmlTestCase.php index 0c4af3e..7ec7f0f 100644 --- a/tests/Xi/Netvisor/XmlTestCase.php +++ b/tests/Xi/Netvisor/XmlTestCase.php @@ -4,6 +4,7 @@ use JMS\Serializer\Serializer; use JMS\Serializer\SerializerBuilder; +use Xi\Netvisor\Component\Validate; use Xi\Netvisor\Serializer\Naming\LowercaseNamingStrategy; class XmlTestCase extends \PHPUnit_Framework_TestCase @@ -13,12 +14,18 @@ class XmlTestCase extends \PHPUnit_Framework_TestCase */ private $serializer; + /** + * @var Validate + */ + private $validate; + public function setUp() { $builder = SerializerBuilder::create(); $builder->setPropertyNamingStrategy(new LowercaseNamingStrategy()); $this->serializer = $builder->build(); + $this->validate = new Validate(); } /** @@ -71,4 +78,9 @@ public function assertXmlContainsTagWithAttributes($tag, $attributes, $xml) $this->assertContains(sprintf('<%s%s>', $tag, $attributeLine), $xml); } + + public function assertXmlIsValid($xml, $dtdPath) + { + $this->assertTrue($this->validate->isValid($xml, $dtdPath)); + } } From d0515b7f173880ffadb5837fa8c7b05ce326dc77 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 17 Mar 2020 15:04:13 +0200 Subject: [PATCH 42/58] Test validity --- tests/Xi/Netvisor/Resource/Xml/CustomerTest.php | 4 +--- tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php | 2 ++ tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php | 5 ++--- tests/Xi/Netvisor/Resource/Xml/VoucherTest.php | 2 ++ 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php index 4bba2d8..afffdf1 100644 --- a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php @@ -2,9 +2,6 @@ namespace Xi\Netvisor\Resource\Xml; -use Xi\Netvisor\Component\Validate; -use Xi\Netvisor\Resource\Xml\Component\AttributeElement; -use Xi\Netvisor\Resource\Xml\Component\WrapperElement; use Xi\Netvisor\Resource\Xml\Customer; use Xi\Netvisor\Resource\Xml\CustomerBaseInformation; use Xi\Netvisor\XmlTestCase; @@ -52,6 +49,7 @@ public function xmlHasRequiredValues() $xml = $this->toXml($this->customer->getSerializableObject()); $this->assertXmlContainsTagWithValue('name', 'Testi Oy', $xml); + $this->assertXmlIsValid($xml, $this->customer->getDtdPath()); } public function testSetOvt() diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php index c83c6ea..46d8f29 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php @@ -89,6 +89,8 @@ public function xmlHasAddedPurchaseInvoiceLines() $this->assertXmlContainsTagWithValue('productname', 'Name 1', $xml); $this->assertXmlContainsTagWithValue('productname', 'Name 2', $xml); + + $this->assertXmlIsValid($xml, $this->invoice->getDtdPath()); } public function testSetComment() diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php index 97c5789..a57e07f 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php @@ -2,9 +2,6 @@ namespace Xi\Netvisor\Resource\Xml; -use Xi\Netvisor\Component\Validate; -use Xi\Netvisor\Resource\Xml\Component\AttributeElement; -use Xi\Netvisor\Resource\Xml\Component\WrapperElement; use Xi\Netvisor\Resource\Xml\SalesInvoice; use Xi\Netvisor\XmlTestCase; @@ -69,6 +66,8 @@ public function xmlHasAddedSalesInvoiceProductLines() $this->assertXmlContainsTagWithValue('productidentifier', '1', $xml); $this->assertXmlContainsTagWithValue('productidentifier', '2', $xml); + + $this->assertXmlIsValid($xml, $this->invoice->getDtdPath()); } public function testSetDeliveryReceiverDetails() diff --git a/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php index 18bbe5b..a94d41b 100644 --- a/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php @@ -49,6 +49,8 @@ public function testXmlHasAddedVoucherLines() $this->assertContains('voucherline', $xml); $this->assertXmlContainsTagWithValue('linesum', 0, $xml); $this->assertSame(2, substr_count($xml, '')); + + $this->assertXmlIsValid($xml, $this->voucher->getDtdPath()); } public function testSetNumber() From a39e3ad16b3def7586041678433dfb35abbcc925 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 17 Mar 2020 15:23:27 +0200 Subject: [PATCH 43/58] Ability to add purchase invoice attachments --- .../Netvisor/Resource/Xml/PurchaseInvoice.php | 1 - .../Xml/PurchaseInvoiceAttachment.php | 19 +++++++ .../Xml/PurchaseInvoiceAttachmentTest.php | 50 +++++++++++++++++++ 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachment.php create mode 100644 tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php index 89b2124..03b6121 100644 --- a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php @@ -5,7 +5,6 @@ use JMS\Serializer\Annotation\XmlList; use Xi\Netvisor\Resource\Xml\Component\Root; use Xi\Netvisor\Resource\Xml\Component\AttributeElement; -use Xi\Netvisor\Resource\Xml\Component\WrapperElement; class PurchaseInvoice extends Root { diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachment.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachment.php new file mode 100644 index 0000000..d0ffd53 --- /dev/null +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachment.php @@ -0,0 +1,19 @@ +mimetype = $mimetype; + $this->attachmentdescription = $description; + $this->filename = $filename; + $this->documentdata = base64_encode($documentdata); + } +} diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php new file mode 100644 index 0000000..4bfb653 --- /dev/null +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php @@ -0,0 +1,50 @@ +attachment = new PurchaseInvoiceAttachment( + 'application/pdf', + 'PDF', + 'filename.pdf', + 'data' + ); + } + + /** + * @test + */ + public function xmlHasRequiredSalesInvoiceValues() + { + $mimetype = 'attachmentdescription'; + $description = 'description'; + $filename = 'filename.pdf'; + $data = 'data'; + + $attachment = new PurchaseInvoiceAttachment( + $mimetype, + $description, + $filename, + $data + ); + + $xml = $this->toXml($attachment); + + $this->assertXmlContainsTagWithValue('mimetype', $mimetype, $xml); + $this->assertXmlContainsTagWithValue('attachmentdescription', $description, $xml); + $this->assertXmlContainsTagWithValue('filename', $filename, $xml); + $this->assertXmlContainsTagWithValue('documentdata', base64_encode($data), $xml); + } +} From 7a4c2682828a6e610cf77a4287a68dcc536c69b8 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 17 Mar 2020 15:32:51 +0200 Subject: [PATCH 44/58] Add invoice source to purchase invoice --- .../Netvisor/Resource/Xml/PurchaseInvoice.php | 23 ++++++++++++++++++ .../Resource/Xml/PurchaseInvoiceTest.php | 24 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php index 03b6121..5660159 100644 --- a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php @@ -8,8 +8,12 @@ class PurchaseInvoice extends Root { + public const INVOICE_SOURCE_FINVOICE = 'finvoice'; + public const INVOICE_SOURCE_MANUAL = 'manual'; + private $invoicenumber; private $invoicedate; + private $invoicesource; private $valuedate; private $duedate; private $vendorname; @@ -132,6 +136,25 @@ public function setComment($comment) return $this; } + /** + * @param string $source + * @return self + */ + public function setInvoiceSource($source) + { + $allowed = [ + static::INVOICE_SOURCE_FINVOICE, + static::INVOICE_SOURCE_MANUAL, + ]; + + if (!in_array($source, $allowed)) { + throw new \Exception('Invalid invoice source: ' . $source); + } + + $this->invoicesource = $source; + return $this; + } + public function getDtdPath() { return $this->getDtdFile('purchaseinvoice.dtd'); diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php index 46d8f29..0911eba 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php @@ -252,4 +252,28 @@ public function testSetBankReferenceNumber() $xml = $this->toXml($this->invoice->getSerializableObject()); $this->assertXmlContainsTagWithValue('bankreferencenumber', $reference, $xml); } + + /** + * @dataProvider setInvoiceSourceProvider + */ + public function testSetInvoiceSource($source, $expectException) + { + if ($expectException) { + $this->expectException(\Exception::class); + } + + $this->invoice->setInvoiceSource($source); + + $xml = $this->toXml($this->invoice->getSerializableObject()); + $this->assertXmlContainsTagWithValue('invoicesource', $source, $xml); + } + + public function setInvoiceSourceProvider() + { + return [ + [PurchaseInvoice::INVOICE_SOURCE_FINVOICE, false], + [PurchaseInvoice::INVOICE_SOURCE_MANUAL, false], + ['Something else', true], + ]; + } } From 993e688bd08c0924adcd3c764f05720d442dd84c Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Tue, 17 Mar 2020 15:47:13 +0200 Subject: [PATCH 45/58] Fixes to purchase attachment --- .../Netvisor/Resource/Xml/PurchaseInvoice.php | 15 +++++++++++++ .../Xml/PurchaseInvoiceAttachment.php | 5 ++--- .../Xml/PurchaseInvoiceAttachmentTest.php | 4 +--- .../Resource/Xml/PurchaseInvoiceTest.php | 21 +++++++++++++++++++ 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php index 5660159..a4752cd 100644 --- a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoice.php @@ -34,6 +34,11 @@ class PurchaseInvoice extends Root */ private $purchaseinvoicelines = array(); + /** + * @XmlList(entry = "purchaseinvoiceattachment") + */ + private $purchaseinvoiceattachments = array(); + /** * @param int $invoiceNumber * @param \DateTime $invoiceDate @@ -79,6 +84,16 @@ public function addPurchaseInvoiceLine(PurchaseInvoiceLine $line) return $this; } + /** + * @param PurchaseInvoiceAttachment $attachment + * @return self + */ + public function addAttachment(PurchaseInvoiceAttachment $attachment) + { + $this->purchaseinvoiceattachments[] = $attachment; + return $this; + } + /** * @param string $bankAccount * @param string $businessId diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachment.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachment.php index d0ffd53..e69f830 100644 --- a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachment.php +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachment.php @@ -4,14 +4,13 @@ class PurchaseInvoiceAttachment { - private $mimetype; + private $mimetype = 'application/pdf'; private $attachmentdescription; private $filename; private $documentdata; - public function __construct($mimetype, $description, $filename, $documentdata) + public function __construct($description, $filename, $documentdata) { - $this->mimetype = $mimetype; $this->attachmentdescription = $description; $this->filename = $filename; $this->documentdata = base64_encode($documentdata); diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php index 4bfb653..5594407 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php @@ -28,13 +28,11 @@ public function setUp() */ public function xmlHasRequiredSalesInvoiceValues() { - $mimetype = 'attachmentdescription'; $description = 'description'; $filename = 'filename.pdf'; $data = 'data'; $attachment = new PurchaseInvoiceAttachment( - $mimetype, $description, $filename, $data @@ -42,7 +40,7 @@ public function xmlHasRequiredSalesInvoiceValues() $xml = $this->toXml($attachment); - $this->assertXmlContainsTagWithValue('mimetype', $mimetype, $xml); + $this->assertXmlContainsTagWithValue('mimetype', 'application/pdf', $xml); $this->assertXmlContainsTagWithValue('attachmentdescription', $description, $xml); $this->assertXmlContainsTagWithValue('filename', $filename, $xml); $this->assertXmlContainsTagWithValue('documentdata', base64_encode($data), $xml); diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php index 0911eba..fae3991 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php @@ -93,6 +93,27 @@ public function xmlHasAddedPurchaseInvoiceLines() $this->assertXmlIsValid($xml, $this->invoice->getDtdPath()); } + public function testAddAttachment() + { + $this->invoice->addAttachment( + new PurchaseInvoiceAttachment('Desc 1', 'File 1', 'Data 1') + ); + + $this->invoice->addAttachment( + new PurchaseInvoiceAttachment('Desc 2', 'File 2', 'Data 2') + ); + + $xml = $this->toXml($this->invoice->getSerializableObject()); + + $this->assertContains('purchaseinvoiceattachments', $xml); + $this->assertContains('purchaseinvoiceattachment', $xml); + + $this->assertXmlContainsTagWithValue('attachmentdescription', 'Desc 1', $xml); + $this->assertXmlContainsTagWithValue('attachmentdescription', 'Desc 2', $xml); + + $this->assertXmlIsValid($xml, $this->invoice->getDtdPath()); + } + public function testSetComment() { $comment = 'Some additional data'; From b2d8c88995d6e2c11f555626564c94f4e10cc017 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Wed, 18 Mar 2020 16:05:30 +0200 Subject: [PATCH 46/58] Ability to send purchase invoice state updates --- library/Xi/Netvisor/Netvisor.php | 10 ++++ .../Dtd/purchaseinvoicepostingdata.dtd | 30 ++++++++++++ .../Resource/Xml/PurchaseInvoiceState.php | 39 +++++++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 23 +++++++++ .../Resource/Xml/PurchaseInvoiceStateTest.php | 48 +++++++++++++++++++ 5 files changed, 150 insertions(+) create mode 100644 library/Xi/Netvisor/Resource/Dtd/purchaseinvoicepostingdata.dtd create mode 100644 library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceState.php create mode 100644 tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceStateTest.php diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index e0e974b..9951429 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -13,6 +13,7 @@ use Xi\Netvisor\Resource\Xml\Customer; use Xi\Netvisor\Resource\Xml\SalesInvoice; use Xi\Netvisor\Resource\Xml\PurchaseInvoice; +use Xi\Netvisor\Resource\Xml\PurchaseInvoiceState; use Xi\Netvisor\Resource\Xml\Voucher; use Xi\Netvisor\Serializer\Naming\LowercaseNamingStrategy; @@ -117,6 +118,15 @@ public function sendPurchaseInvoice(PurchaseInvoice $invoice) return $this->requestWithBody($invoice, 'purchaseinvoice'); } + /** + * @param PurchaseInvoiceState $state + * @return null|string + */ + public function updatePurchaseInvoiceState(PurchaseInvoiceState $state) + { + return $this->requestWithBody($state, 'purchaseinvoicepostingdata'); + } + /** * @param Customer $customer * @param int $id diff --git a/library/Xi/Netvisor/Resource/Dtd/purchaseinvoicepostingdata.dtd b/library/Xi/Netvisor/Resource/Dtd/purchaseinvoicepostingdata.dtd new file mode 100644 index 0000000..767550b --- /dev/null +++ b/library/Xi/Netvisor/Resource/Dtd/purchaseinvoicepostingdata.dtd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> diff --git a/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceState.php b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceState.php new file mode 100644 index 0000000..ab16678 --- /dev/null +++ b/library/Xi/Netvisor/Resource/Xml/PurchaseInvoiceState.php @@ -0,0 +1,39 @@ +purchaseinvoicenetvisorkey = $netvisorId; + $this->status = $status; + $this->isreadyforaccounting = (int) $isReadyForAccounting; + } + + public function getDtdPath() + { + return $this->getDtdFile('purchaseinvoicepostingdata.dtd'); + } + + protected function getXmlName() + { + return 'purchaseinvoicepostingdata'; + } +} diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 8ac4621..7b8965b 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -12,6 +12,7 @@ use Xi\Netvisor\Resource\Xml\TestResource; use GuzzleHttp\Psr7\Response; use Xi\Netvisor\Resource\Xml\PurchaseInvoice; +use Xi\Netvisor\Resource\Xml\PurchaseInvoiceState; class NetvisorTest extends \PHPUnit_Framework_TestCase { @@ -348,4 +349,26 @@ public function testSendPurchaseInvoice() $netvisorMock->sendPurchaseInvoice($purchaseInvoiceMock); } + + public function testUpdatePurchaseInvoiceState() + { + $purchaseInvoiceStateMock = $this + ->getMockBuilder(PurchaseInvoiceState::class) + ->disableOriginalConstructor() + ->getMock(); + + // Mock requestWithBody + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['requestWithBody']) + ->getMock(); + + $netvisorMock + ->expects($this->once()) + ->method('requestWithBody') + ->with($purchaseInvoiceStateMock, 'purchaseinvoicepostingdata'); + + $netvisorMock->updatePurchaseInvoiceState($purchaseInvoiceStateMock); + } } diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceStateTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceStateTest.php new file mode 100644 index 0000000..458ba20 --- /dev/null +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceStateTest.php @@ -0,0 +1,48 @@ +invoiceState = new PurchaseInvoiceState(123, 'approved', false); + } + + /** + * @test + */ + public function hasDtd() + { + $this->assertNotNull($this->invoiceState->getDtdPath()); + } + + /** + * @test + */ + public function xmlHasRequiredSalesInvoiceValues() + { + $netvisorId = 123; + $status = 'approved'; + $readyForAccounting = false; + + $invoiceState = new PurchaseInvoiceState($netvisorId, $status, $readyForAccounting); + + $xml = $this->toXml($invoiceState->getSerializableObject()); + + $this->assertXmlContainsTagWithValue('purchaseinvoicenetvisorkey', $netvisorId, $xml); + $this->assertXmlContainsTagWithValue('status', $status, $xml); + $this->assertXmlContainsTagWithValue('isreadyforaccounting', (int) $readyForAccounting, $xml); + + $this->assertXmlIsValid($xml, $invoiceState->getDtdPath()); + } +} From 22aedd8c30c75a950a831d7c7e2d922fb3b42a7d Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Thu, 26 Mar 2020 15:35:48 +0200 Subject: [PATCH 47/58] Don't strip CDATA segments out from message --- library/Xi/Netvisor/Netvisor.php | 1 - tests/Xi/Netvisor/NetvisorTest.php | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 9951429..d84161f 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -334,7 +334,6 @@ private function createSerializer() public function processXml($xml) { $xml = str_replace("\n", "", $xml); - $xml = str_replace(array(''), '', $xml); return $xml; } diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 7b8965b..2a4efb9 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -154,9 +154,9 @@ public function sendInvoiceSendsRequest() */ public function processInvoiceToWorkWithNetvisor() { - $xml = "\n"; + $xml = "\n"; - $this->assertEquals('2014-02-17', $this->netvisor->processXml($xml)); + $this->assertEquals('', $this->netvisor->processXml($xml)); } public function testUpdateCustomer() From 88a320c1d0994ec8112ac6ea43dee8a7e7ca37ca Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Thu, 7 May 2020 11:12:24 +0300 Subject: [PATCH 48/58] Get purchase invoice --- library/Xi/Netvisor/Netvisor.php | 17 +++++++++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index d84161f..df3a6b0 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -230,6 +230,23 @@ public function getSalesInvoice($id) ); } + /** + * Get details for a invoice identified by Netvisor id. + * + * @param int $id + * @param bool $omitAttachments + * @return null|string + */ + public function getPurchaseInvoice($id) + { + return $this->get( + 'getpurchaseinvoice', + [ + 'netvisorkey' => $id, + ] + ); + } + /** * Get vouchers by timeframe * diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 2a4efb9..18553ab 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -260,6 +260,25 @@ public function testGetSalesInvoice() $netvisorMock->getSalesInvoice($id); } + public function testGetPurchaseInvoice() + { + $id = 1234564; + + // @var Netvisor $netvisorMock + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['get']) + ->getMock(); + + $netvisorMock + ->expects($this->once()) + ->method('get') + ->with('getpurchaseinvoice', ['netvisorkey' => $id]); + + $netvisorMock->getPurchaseInvoice($id); + } + public function testGetVouchers() { $start = new \DateTime('2000-01-01'); From 4c4ee4146f33523736798279e375d35db91b6d7d Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Mon, 11 May 2020 08:47:16 +0300 Subject: [PATCH 49/58] Ability to fetch multiple purchase invoice by id --- library/Xi/Netvisor/Netvisor.php | 18 +++++++++--------- tests/Xi/Netvisor/NetvisorTest.php | 21 ++++++++++++++++++--- 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index df3a6b0..4d802cb 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -231,20 +231,20 @@ public function getSalesInvoice($id) } /** - * Get details for a invoice identified by Netvisor id. + * Get details for a invoices identified by Netvisor id. * - * @param int $id - * @param bool $omitAttachments + * @param int|array $id * @return null|string */ public function getPurchaseInvoice($id) { - return $this->get( - 'getpurchaseinvoice', - [ - 'netvisorkey' => $id, - ] - ); + $params['netvisorkey'] = $id; + + if (is_array($id)) { + $params = ['netvisorkeylist' => implode(',', $id)]; + } + + return $this->get('getpurchaseinvoice', $params); } /** diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 18553ab..e2efb49 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -260,9 +260,16 @@ public function testGetSalesInvoice() $netvisorMock->getSalesInvoice($id); } - public function testGetPurchaseInvoice() + /** + * @dataProvider getPurchaseInvoiceProvider + */ + public function testGetPurchaseInvoice($id) { - $id = 1234564; + $requestParams = ['netvisorkey' => $id]; + + if (is_array($id)) { + $requestParams = ['netvisorkeylist' => implode(',', $id)]; + } // @var Netvisor $netvisorMock $netvisorMock = $this @@ -274,11 +281,19 @@ public function testGetPurchaseInvoice() $netvisorMock ->expects($this->once()) ->method('get') - ->with('getpurchaseinvoice', ['netvisorkey' => $id]); + ->with('getpurchaseinvoice', $requestParams); $netvisorMock->getPurchaseInvoice($id); } + public function getPurchaseInvoiceProvider() + { + return [ + [123456], + [[123456, 155]], + ]; + } + public function testGetVouchers() { $start = new \DateTime('2000-01-01'); From 25360b8cabe21df9890c21b4c5133c82d34e9ba0 Mon Sep 17 00:00:00 2001 From: Petteri Hakala <> Date: Mon, 11 May 2020 15:46:51 +0300 Subject: [PATCH 50/58] Revert previous, apparently not working --- library/Xi/Netvisor/Netvisor.php | 15 +++++++-------- tests/Xi/Netvisor/NetvisorTest.php | 18 ++---------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 4d802cb..abc2fd9 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -233,18 +233,17 @@ public function getSalesInvoice($id) /** * Get details for a invoices identified by Netvisor id. * - * @param int|array $id + * @param int $id * @return null|string */ public function getPurchaseInvoice($id) { - $params['netvisorkey'] = $id; - - if (is_array($id)) { - $params = ['netvisorkeylist' => implode(',', $id)]; - } - - return $this->get('getpurchaseinvoice', $params); + return $this->get( + 'getpurchaseinvoice', + [ + 'netvisorkey' => $id, + ] + ); } /** diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index e2efb49..9e7d2b4 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -260,17 +260,11 @@ public function testGetSalesInvoice() $netvisorMock->getSalesInvoice($id); } - /** - * @dataProvider getPurchaseInvoiceProvider - */ - public function testGetPurchaseInvoice($id) + public function testGetPurchaseInvoice() { + $id = 123125; $requestParams = ['netvisorkey' => $id]; - if (is_array($id)) { - $requestParams = ['netvisorkeylist' => implode(',', $id)]; - } - // @var Netvisor $netvisorMock $netvisorMock = $this ->getMockBuilder(Netvisor::class) @@ -286,14 +280,6 @@ public function testGetPurchaseInvoice($id) $netvisorMock->getPurchaseInvoice($id); } - public function getPurchaseInvoiceProvider() - { - return [ - [123456], - [[123456, 155]], - ]; - } - public function testGetVouchers() { $start = new \DateTime('2000-01-01'); From c3530fada14ca90638ae296d0a6b33c9a164cbd5 Mon Sep 17 00:00:00 2001 From: Petteri Hakala Date: Tue, 30 Jun 2020 11:15:06 +0300 Subject: [PATCH 51/58] Remove invalid ovt functionality --- .../Netvisor/Resource/Xml/CustomerBaseInformation.php | 11 ----------- tests/Xi/Netvisor/Resource/Xml/CustomerTest.php | 8 -------- 2 files changed, 19 deletions(-) diff --git a/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php b/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php index 99eb571..aa69151 100644 --- a/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php +++ b/library/Xi/Netvisor/Resource/Xml/CustomerBaseInformation.php @@ -5,7 +5,6 @@ class CustomerBaseInformation { private $externalIdentifier; - private $organizationunitnumber; private $name; private $streetAddress; private $city; @@ -36,16 +35,6 @@ public function __construct( $this->country = $country; } - /** - * @param string $ovt - * @return self - */ - public function setOvt($ovt) - { - $this->organizationunitnumber = $ovt; - return $this; - } - /** * @param string $number * @return self diff --git a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php index afffdf1..869fece 100644 --- a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php @@ -52,14 +52,6 @@ public function xmlHasRequiredValues() $this->assertXmlIsValid($xml, $this->customer->getDtdPath()); } - public function testSetOvt() - { - $ovt = '001231564'; - $this->baseInformation->setOvt($ovt); - $xml = $this->toXml($this->customer->getSerializableObject()); - $this->assertXmlContainsTagWithValue('organizationunitnumber', $ovt, $xml); - } - public function testSetPhoneNumber() { $number = '0501234567'; From 33b671eafb88ab7f958fb817b69320c2089f0047 Mon Sep 17 00:00:00 2001 From: Petteri Hakala Date: Tue, 1 Dec 2020 11:01:46 +0200 Subject: [PATCH 52/58] Updated guzzle version --- composer.json | 4 +- composer.lock | 259 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 192 insertions(+), 71 deletions(-) diff --git a/composer.json b/composer.json index 77f993d..6472d8b 100644 --- a/composer.json +++ b/composer.json @@ -19,9 +19,9 @@ ], "require": { - "php": "^5.6 || ^7.0", + "php": "^7.2", "jms/serializer": "^1.4", - "guzzlehttp/guzzle": "^6.2" + "guzzlehttp/guzzle": "^7.2" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 8b2eb2b..f43cd89 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,10 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "hash": "36b7c793a96ac0c2fefd9be0fd61697e", - "content-hash": "8890ff7472faa1a3d9a53fcbde7712af", + "content-hash": "6f1512f19e932147ed0129067866729b", "packages": [ { "name": "doctrine/annotations", @@ -73,7 +72,7 @@ "docblock", "parser" ], - "time": "2016-10-24 11:45:47" + "time": "2016-10-24T11:45:47+00:00" }, { "name": "doctrine/instantiator", @@ -127,7 +126,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "doctrine/lexer", @@ -181,45 +180,56 @@ "lexer", "parser" ], - "time": "2014-09-09 13:34:57" + "time": "2014-09-09T13:34:57+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "6.2.2", + "version": "7.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60" + "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ebf29dee597f02f09f4d5bbecc68230ea9b08f60", - "reference": "ebf29dee597f02f09f4d5bbecc68230ea9b08f60", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79", + "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79", "shasum": "" }, "require": { - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.3.1", - "php": ">=5.5" + "ext-json": "*", + "guzzlehttp/promises": "^1.4", + "guzzlehttp/psr7": "^1.7", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0", - "psr/log": "^1.0" + "php-http/client-integration-tests": "^3.0", + "phpunit/phpunit": "^8.5.5 || ^9.3.5", + "psr/log": "^1.1" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.2-dev" + "dev-master": "7.1-dev" } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -230,6 +240,11 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" } ], "description": "Guzzle is a PHP HTTP client library", @@ -240,30 +255,32 @@ "framework", "http", "http client", + "psr-18", + "psr-7", "rest", "web service" ], - "time": "2016-10-08 15:01:37" + "time": "2020-10-10T11:47:56+00:00" }, { "name": "guzzlehttp/promises", - "version": "v1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + "reference": "60d379c243457e073cff02bc323a2a86cb355631" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", - "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631", + "reference": "60d379c243457e073cff02bc323a2a86cb355631", "shasum": "" }, "require": { - "php": ">=5.5.0" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "^4.0" + "symfony/phpunit-bridge": "^4.4 || ^5.1" }, "type": "library", "extra": { @@ -294,36 +311,41 @@ "keywords": [ "promise" ], - "time": "2016-12-20 10:07:11" + "time": "2020-09-30T07:37:28+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.3.1", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", - "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", + "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", "shasum": "" }, "require": { "php": ">=5.4.0", - "psr/http-message": "~1.0" + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" }, "provide": { "psr/http-message-implementation": "1.0" }, "require-dev": { - "phpunit/phpunit": "~4.0" + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.7-dev" } }, "autoload": { @@ -343,16 +365,24 @@ "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" } ], - "description": "PSR-7 message implementation", + "description": "PSR-7 message implementation that also provides common utility methods", "keywords": [ "http", "message", + "psr-7", + "request", + "response", "stream", - "uri" + "uri", + "url" ], - "time": "2016-06-24 23:00:38" + "time": "2020-09-30T07:37:11+00:00" }, { "name": "jms/metadata", @@ -403,7 +433,7 @@ "xml", "yaml" ], - "time": "2016-12-05 10:18:33" + "time": "2016-12-05T10:18:33+00:00" }, { "name": "jms/parser-lib", @@ -438,7 +468,7 @@ "Apache2" ], "description": "A library for easily creating recursive-descent parsers.", - "time": "2012-11-18 18:08:43" + "time": "2012-11-18T18:08:43+00:00" }, { "name": "jms/serializer", @@ -513,7 +543,7 @@ "serialization", "xml" ], - "time": "2016-11-13 10:20:11" + "time": "2016-11-13T10:20:11+00:00" }, { "name": "phpcollection/phpcollection", @@ -561,7 +591,7 @@ "sequence", "set" ], - "time": "2015-05-17 12:39:23" + "time": "2015-05-17T12:39:23+00:00" }, { "name": "phpoption/phpoption", @@ -611,7 +641,56 @@ "php", "type" ], - "time": "2015-07-25 16:39:46" + "time": "2015-07-25T16:39:46+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "reference": "2dfb5f6c5eff0e91e20e913f8c5452ed95b86621", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "time": "2020-06-29T06:28:15+00:00" }, { "name": "psr/http-message", @@ -661,7 +740,47 @@ "request", "response" ], - "time": "2016-08-06 14:39:51" + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" } ], "packages-dev": [ @@ -705,7 +824,7 @@ "object", "object graph" ], - "time": "2016-10-31 17:19:45" + "time": "2016-10-31T17:19:45+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -759,7 +878,7 @@ "reflection", "static analysis" ], - "time": "2015-12-27 11:43:31" + "time": "2015-12-27T11:43:31+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -804,7 +923,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30 07:12:33" + "time": "2016-09-30T07:12:33+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -851,7 +970,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25 06:54:22" + "time": "2016-11-25T06:54:22+00:00" }, { "name": "phpspec/prophecy", @@ -914,7 +1033,7 @@ "spy", "stub" ], - "time": "2016-11-21 14:58:47" + "time": "2016-11-21T14:58:47+00:00" }, { "name": "phpunit/php-code-coverage", @@ -977,7 +1096,7 @@ "testing", "xunit" ], - "time": "2016-12-20 15:22:42" + "time": "2016-12-20T15:22:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -1024,7 +1143,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03 07:40:28" + "time": "2016-10-03T07:40:28+00:00" }, { "name": "phpunit/php-text-template", @@ -1065,7 +1184,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -1109,7 +1228,7 @@ "keywords": [ "timer" ], - "time": "2016-05-12 18:03:57" + "time": "2016-05-12T18:03:57+00:00" }, { "name": "phpunit/php-token-stream", @@ -1158,7 +1277,8 @@ "keywords": [ "tokenizer" ], - "time": "2016-11-15 14:06:22" + "abandoned": true, + "time": "2016-11-15T14:06:22+00:00" }, { "name": "phpunit/phpunit", @@ -1240,7 +1360,7 @@ "testing", "xunit" ], - "time": "2016-12-13 16:19:44" + "time": "2016-12-13T16:19:44+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -1299,7 +1419,8 @@ "mock", "xunit" ], - "time": "2016-12-08 20:27:08" + "abandoned": true, + "time": "2016-12-08T20:27:08+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -1344,7 +1465,7 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13 06:45:14" + "time": "2016-02-13T06:45:14+00:00" }, { "name": "sebastian/comparator", @@ -1408,7 +1529,7 @@ "compare", "equality" ], - "time": "2016-11-19 09:18:40" + "time": "2016-11-19T09:18:40+00:00" }, { "name": "sebastian/diff", @@ -1460,7 +1581,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-12-08T07:14:41+00:00" }, { "name": "sebastian/environment", @@ -1510,7 +1631,7 @@ "environment", "hhvm" ], - "time": "2016-11-26 07:53:53" + "time": "2016-11-26T07:53:53+00:00" }, { "name": "sebastian/exporter", @@ -1577,7 +1698,7 @@ "export", "exporter" ], - "time": "2016-11-19 08:54:04" + "time": "2016-11-19T08:54:04+00:00" }, { "name": "sebastian/global-state", @@ -1628,7 +1749,7 @@ "keywords": [ "global state" ], - "time": "2015-10-12 03:26:01" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/object-enumerator", @@ -1674,7 +1795,7 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-11-19 07:35:10" + "time": "2016-11-19T07:35:10+00:00" }, { "name": "sebastian/recursion-context", @@ -1727,7 +1848,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19 07:33:16" + "time": "2016-11-19T07:33:16+00:00" }, { "name": "sebastian/resource-operations", @@ -1769,7 +1890,7 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28 20:34:47" + "time": "2015-07-28T20:34:47+00:00" }, { "name": "sebastian/version", @@ -1812,7 +1933,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03 07:35:21" + "time": "2016-10-03T07:35:21+00:00" }, { "name": "symfony/yaml", @@ -1867,7 +1988,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-12-10 10:07:06" + "time": "2016-12-10T10:07:06+00:00" }, { "name": "webmozart/assert", @@ -1917,7 +2038,7 @@ "check", "validate" ], - "time": "2016-11-23 20:04:58" + "time": "2016-11-23T20:04:58+00:00" } ], "aliases": [], @@ -1926,7 +2047,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^5.6 || ^7.0" + "php": "^7.2" }, "platform-dev": [] } From f1b5f01cd9ed6b280fa08113cffb511bb7ae24c8 Mon Sep 17 00:00:00 2001 From: Otto Kilpirinne Date: Tue, 23 Nov 2021 13:29:16 +0200 Subject: [PATCH 53/58] add getSalesInvoices method --- library/Xi/Netvisor/Netvisor.php | 18 ++++++++++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 26 ++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index abc2fd9..bd6a6de 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -230,6 +230,24 @@ public function getSalesInvoice($id) ); } + /** + * Get sales invoices by last time modified and invoices above Netvisor key + * + * @param dateTime $modifiedAfterDate + * @param int $invoiceId + * @return null|string + */ + public function getSalesInvoices(\DateTime $modifiedAfterDate, int $invoiceId) + { + return $this->get( + 'getsalesinvoice', + [ + 'lastmodifiedstart' => $modifiedAfterDate->format('Y-m-d'), + 'invoicesabovenetvisorkey' => $invoiceId, + ] + ); + } + /** * Get details for a invoices identified by Netvisor id. * diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 9e7d2b4..211fbe4 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -391,4 +391,30 @@ public function testUpdatePurchaseInvoiceState() $netvisorMock->updatePurchaseInvoiceState($purchaseInvoiceStateMock); } + + public function testGetSalesInvoices() + { + $date = new \DateTime('2000-01-01'); + $lastInvoiceId = 200; + + // @var Netvisor $netvisorMock + $netvisorMock = $this + ->getMockBuilder(Netvisor::class) + ->disableOriginalConstructor() + ->setMethods(['get']) + ->getMock(); + + $netvisorMock + ->expects($this->once()) + ->method('get') + ->with( + 'getsalesinvoice', + [ + 'lastmodifiedstart' => $date->format('Y-m-d'), + 'invoicesabovenetvisorkey' => $lastInvoiceId, + ] + ); + + $netvisorMock->getSalesInvoices($date, $lastInvoiceId); + } } From 2fe6af2726d281b4ab481dbe32bc3426e5390672 Mon Sep 17 00:00:00 2001 From: Otto Kilpirinne Date: Tue, 23 Nov 2021 14:10:32 +0200 Subject: [PATCH 54/58] Tests fixed to use phpunit 7.5.20 --- tests/Xi/Netvisor/Component/RequestTest.php | 10 +++++----- tests/Xi/Netvisor/ConfigTest.php | 3 ++- tests/Xi/Netvisor/NetvisorTest.php | 8 +++++--- .../Resource/Xml/Component/AttributeElementTest.php | 3 ++- .../Serializer/Naming/LowercaseNamingStrategyTest.php | 3 ++- tests/Xi/Netvisor/XmlTestCase.php | 3 ++- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/tests/Xi/Netvisor/Component/RequestTest.php b/tests/Xi/Netvisor/Component/RequestTest.php index b9cca36..aa5c071 100644 --- a/tests/Xi/Netvisor/Component/RequestTest.php +++ b/tests/Xi/Netvisor/Component/RequestTest.php @@ -6,8 +6,10 @@ use Xi\Netvisor\Component\Request; use Xi\Netvisor\Config; use GuzzleHttp\Client; +use PHPUnit\Framework\TestCase; +use Xi\Netvisor\Exception\NetvisorException; -class RequestTest extends \PHPUnit_Framework_TestCase +class RequestTest extends TestCase { /** * @var Request @@ -91,10 +93,8 @@ public function throwsExceptionIfResponseStatusIsFailed() new Response('200', array(), $xmlResponse) )); - $this->setExpectedException( - 'Xi\Netvisor\Exception\NetvisorException', - 'AUTHENTICATION_FAILED :: Integraatiokumppania ei löydy, katso dokumentaatio' - ); + $this->expectException(NetvisorException::class); + $this->expectExceptionMessage('AUTHENTICATION_FAILED :: Integraatiokumppania ei löydy, katso dokumentaatio'); $this->request->post( '', diff --git a/tests/Xi/Netvisor/ConfigTest.php b/tests/Xi/Netvisor/ConfigTest.php index 8a47067..f76e789 100644 --- a/tests/Xi/Netvisor/ConfigTest.php +++ b/tests/Xi/Netvisor/ConfigTest.php @@ -2,9 +2,10 @@ namespace Xi\Netvisor\Component; +use PHPUnit\Framework\TestCase; use Xi\Netvisor\Config; -class ConfigTest extends \PHPUnit_Framework_TestCase +class ConfigTest extends TestCase { /** * @test diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 211fbe4..8af7b0a 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -11,10 +11,12 @@ use GuzzleHttp\Client; use Xi\Netvisor\Resource\Xml\TestResource; use GuzzleHttp\Psr7\Response; +use PHPUnit\Framework\TestCase; +use Xi\Netvisor\Exception\NetvisorException; use Xi\Netvisor\Resource\Xml\PurchaseInvoice; use Xi\Netvisor\Resource\Xml\PurchaseInvoiceState; -class NetvisorTest extends \PHPUnit_Framework_TestCase +class NetvisorTest extends TestCase { /** * @var Netvisor @@ -92,8 +94,8 @@ public function returnsNullIfNotEnabled() */ public function throwsIfXmlIsNotValid() { - $this->setExpectedException('Xi\Netvisor\Exception\NetvisorException', 'XML is not valid according to DTD'); - + $this->expectExceptionMessage('XML is not valid according to DTD'); + $this->expectException(NetvisorException::class); $this->netvisor->requestWithBody(new TestResource(), 'service', array(), null); } diff --git a/tests/Xi/Netvisor/Resource/Xml/Component/AttributeElementTest.php b/tests/Xi/Netvisor/Resource/Xml/Component/AttributeElementTest.php index 0190054..fe3187d 100644 --- a/tests/Xi/Netvisor/Resource/Xml/Component/AttributeElementTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/Component/AttributeElementTest.php @@ -2,9 +2,10 @@ namespace Xi\Netvisor\Resource\Xml\Component; +use PHPUnit\Framework\TestCase; use Xi\Netvisor\Resource\Xml\Component\AttributeElement; -class AttributeElementTest extends \PHPUnit_Framework_TestCase +class AttributeElementTest extends TestCase { public function testConstructor() { diff --git a/tests/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategyTest.php b/tests/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategyTest.php index 4792f0f..064a95d 100644 --- a/tests/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategyTest.php +++ b/tests/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategyTest.php @@ -3,9 +3,10 @@ namespace Xi\Netvisor\Component; use JMS\Serializer\Metadata\PropertyMetadata; +use PHPUnit\Framework\TestCase; use Xi\Netvisor\Serializer\Naming\LowercaseNamingStrategy; -class LowercaseNamingStrategyTest extends \PHPUnit_Framework_TestCase +class LowercaseNamingStrategyTest extends TestCase { /** * @test diff --git a/tests/Xi/Netvisor/XmlTestCase.php b/tests/Xi/Netvisor/XmlTestCase.php index 7ec7f0f..a0d602f 100644 --- a/tests/Xi/Netvisor/XmlTestCase.php +++ b/tests/Xi/Netvisor/XmlTestCase.php @@ -6,8 +6,9 @@ use JMS\Serializer\SerializerBuilder; use Xi\Netvisor\Component\Validate; use Xi\Netvisor\Serializer\Naming\LowercaseNamingStrategy; +use PHPUnit\Framework\TestCase; -class XmlTestCase extends \PHPUnit_Framework_TestCase +class XmlTestCase extends TestCase { /** * @var Serializer From b356b2a322ab8eb18ffb1c3ee1d0acdc22ed25da Mon Sep 17 00:00:00 2001 From: Otto Kilpirinne Date: Tue, 23 Nov 2021 14:11:05 +0200 Subject: [PATCH 55/58] Update phpunit version --- composer.json | 2 +- composer.lock | 1628 ++++++++++++++++++++++++++++++++++++------------- 2 files changed, 1198 insertions(+), 432 deletions(-) diff --git a/composer.json b/composer.json index 6472d8b..0f8e099 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,7 @@ }, "require-dev": { - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^7.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index f43cd89..7a943b3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,36 +4,36 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6f1512f19e932147ed0129067866729b", + "content-hash": "f65b59ac2ac55c29f4b058bdebb2ab8e", "packages": [ { "name": "doctrine/annotations", - "version": "v1.3.0", + "version": "1.13.2", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "30e07cf03edc3cd3ef579d0dd4dd8c58250799a5" + "reference": "5b668aef16090008790395c02c893b1ba13f7e08" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/30e07cf03edc3cd3ef579d0dd4dd8c58250799a5", - "reference": "30e07cf03edc3cd3ef579d0dd4dd8c58250799a5", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/5b668aef16090008790395c02c893b1ba13f7e08", + "reference": "5b668aef16090008790395c02c893b1ba13f7e08", "shasum": "" }, "require": { "doctrine/lexer": "1.*", - "php": "^5.6 || ^7.0" + "ext-tokenizer": "*", + "php": "^7.1 || ^8.0", + "psr/cache": "^1 || ^2 || ^3" }, "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^5.6.1" + "doctrine/cache": "^1.11 || ^2.0", + "doctrine/coding-standard": "^6.0 || ^8.1", + "phpstan/phpstan": "^0.12.20", + "phpunit/phpunit": "^7.5 || ^8.0 || ^9.1.5", + "symfony/cache": "^4.4 || ^5.2" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" @@ -44,6 +44,10 @@ "MIT" ], "authors": [ + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, { "name": "Roman Borschel", "email": "roman@code-factory.org" @@ -52,10 +56,6 @@ "name": "Benjamin Eberlei", "email": "kontakt@beberlei.de" }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, { "name": "Jonathan Wage", "email": "jonwage@gmail.com" @@ -66,44 +66,45 @@ } ], "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", + "homepage": "https://www.doctrine-project.org/projects/annotations.html", "keywords": [ "annotations", "docblock", "parser" ], - "time": "2016-10-24T11:45:47+00:00" + "support": { + "issues": "https://github.com/doctrine/annotations/issues", + "source": "https://github.com/doctrine/annotations/tree/1.13.2" + }, + "time": "2021-08-05T19:00:23+00:00" }, { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b", + "reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1 || ^8.0" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^8.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpbench/phpbench": "^0.13 || 1.0.0-alpha2", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" @@ -117,43 +118,66 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "https://ocramius.github.io/" } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "support": { + "issues": "https://github.com/doctrine/instantiator/issues", + "source": "https://github.com/doctrine/instantiator/tree/1.4.0" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator", + "type": "tidelift" + } + ], + "time": "2020-11-10T18:47:58+00:00" }, { "name": "doctrine/lexer", - "version": "v1.0.1", + "version": "1.2.1", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", + "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "phpstan/phpstan": "^0.11.8", + "phpunit/phpunit": "^8.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" + "psr-4": { + "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" } }, "notification-url": "https://packagist.org/downloads/", @@ -161,56 +185,79 @@ "MIT" ], "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, { "name": "Guilherme Blanco", "email": "guilhermeblanco@gmail.com" }, + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, { "name": "Johannes Schmitt", "email": "schmittjoh@gmail.com" } ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", + "description": "PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "https://www.doctrine-project.org/projects/lexer.html", "keywords": [ + "annotations", + "docblock", "lexer", - "parser" + "parser", + "php" ], - "time": "2014-09-09T13:34:57+00:00" + "support": { + "issues": "https://github.com/doctrine/lexer/issues", + "source": "https://github.com/doctrine/lexer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Flexer", + "type": "tidelift" + } + ], + "time": "2020-05-25T17:44:05+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.2.0", + "version": "7.4.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79" + "reference": "868b3571a039f0ebc11ac8f344f4080babe2cb94" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/0aa74dfb41ae110835923ef10a9d803a22d50e79", - "reference": "0aa74dfb41ae110835923ef10a9d803a22d50e79", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/868b3571a039f0ebc11ac8f344f4080babe2cb94", + "reference": "868b3571a039f0ebc11ac8f344f4080babe2cb94", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.4", - "guzzlehttp/psr7": "^1.7", + "guzzlehttp/promises": "^1.5", + "guzzlehttp/psr7": "^1.8.3 || ^2.1", "php": "^7.2.5 || ^8.0", - "psr/http-client": "^1.0" + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2" }, "provide": { "psr/http-client-implementation": "1.0" }, "require-dev": { + "bamarni/composer-bin-plugin": "^1.4.1", "ext-curl": "*", "php-http/client-integration-tests": "^3.0", "phpunit/phpunit": "^8.5.5 || ^9.3.5", - "psr/log": "^1.1" + "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { "ext-curl": "Required for CURL handler support", @@ -220,7 +267,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.1-dev" + "dev-master": "7.4-dev" } }, "autoload": { @@ -236,19 +283,43 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, { "name": "Márk Sági-Kazár", "email": "mark.sagikazar@gmail.com", - "homepage": "https://sagikazarmark.hu" + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle is a PHP HTTP client library", - "homepage": "http://guzzlephp.org/", "keywords": [ "client", "curl", @@ -260,20 +331,38 @@ "rest", "web service" ], - "time": "2020-10-10T11:47:56+00:00" + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.4.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2021-10-18T09:52:00+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.4.0", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "60d379c243457e073cff02bc323a2a86cb355631" + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/60d379c243457e073cff02bc323a2a86cb355631", - "reference": "60d379c243457e073cff02bc323a2a86cb355631", + "url": "https://api.github.com/repos/guzzle/promises/zipball/fe752aedc9fd8fcca3fe7ad05d419d32998a06da", + "reference": "fe752aedc9fd8fcca3fe7ad05d419d32998a06da", "shasum": "" }, "require": { @@ -285,7 +374,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "1.5-dev" } }, "autoload": { @@ -301,43 +390,79 @@ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" } ], "description": "Guzzle promises library", "keywords": [ "promise" ], - "time": "2020-09-30T07:37:28+00:00" + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/1.5.1" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2021-10-22T20:56:57+00:00" }, { "name": "guzzlehttp/psr7", - "version": "1.7.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" + "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", - "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/089edd38f5b8abba6cb01567c2a8aaa47cec4c72", + "reference": "089edd38f5b8abba6cb01567c2a8aaa47cec4c72", "shasum": "" }, "require": { - "php": ">=5.4.0", - "psr/http-message": "~1.0", - "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0", + "ralouphie/getallheaders": "^3.0" }, "provide": { + "psr/http-factory-implementation": "1.0", "psr/http-message-implementation": "1.0" }, "require-dev": { - "ext-zlib": "*", - "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.10" + "bamarni/composer-bin-plugin": "^1.4.1", + "http-interop/http-factory-tests": "^0.9", + "phpunit/phpunit": "^8.5.8 || ^9.3.10" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -345,30 +470,53 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7-dev" + "dev-master": "2.1-dev" } }, "autoload": { "psr-4": { "GuzzleHttp\\Psr7\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, { "name": "Michael Dowling", "email": "mtdowling@gmail.com", "homepage": "https://github.com/mtdowling" }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, { "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" } ], "description": "PSR-7 message implementation that also provides common utility methods", @@ -382,20 +530,38 @@ "uri", "url" ], - "time": "2020-09-30T07:37:11+00:00" + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.1.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2021-10-06T17:43:30+00:00" }, { "name": "jms/metadata", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/metadata.git", - "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab" + "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/6a06970a10e0a532fb52d3959547123b84a3b3ab", - "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/e5854ab1aa643623dc64adde718a8eec32b957a8", + "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8", "shasum": "" }, "require": { @@ -418,9 +584,13 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache-2.0" + "MIT" ], "authors": [ + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" + }, { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com" @@ -433,7 +603,11 @@ "xml", "yaml" ], - "time": "2016-12-05T10:18:33+00:00" + "support": { + "issues": "https://github.com/schmittjoh/metadata/issues", + "source": "https://github.com/schmittjoh/metadata/tree/1.x" + }, + "time": "2018-10-26T12:40:10+00:00" }, { "name": "jms/parser-lib", @@ -468,28 +642,32 @@ "Apache2" ], "description": "A library for easily creating recursive-descent parsers.", + "support": { + "issues": "https://github.com/schmittjoh/parser-lib/issues", + "source": "https://github.com/schmittjoh/parser-lib/tree/1.0.0" + }, "time": "2012-11-18T18:08:43+00:00" }, { "name": "jms/serializer", - "version": "1.4.2", + "version": "1.14.1", "source": { "type": "git", "url": "https://github.com/schmittjoh/serializer.git", - "reference": "f39d8b4660d5cef43b0c3265ce642173d9b2c58b" + "reference": "ba908d278fff27ec01fb4349f372634ffcd697c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/f39d8b4660d5cef43b0c3265ce642173d9b2c58b", - "reference": "f39d8b4660d5cef43b0c3265ce642173d9b2c58b", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/ba908d278fff27ec01fb4349f372634ffcd697c0", + "reference": "ba908d278fff27ec01fb4349f372634ffcd697c0", "shasum": "" }, "require": { "doctrine/annotations": "^1.0", "doctrine/instantiator": "^1.0.3", - "jms/metadata": "~1.1", + "jms/metadata": "^1.3", "jms/parser-lib": "1.*", - "php": ">=5.5.0", + "php": "^5.5|^7.0", "phpcollection/phpcollection": "~0.1", "phpoption/phpoption": "^1.1" }, @@ -503,20 +681,25 @@ "jackalope/jackalope-doctrine-dbal": "^1.1.5", "phpunit/phpunit": "^4.8|^5.0", "propel/propel1": "~1.7", + "psr/container": "^1.0", + "symfony/dependency-injection": "^2.7|^3.3|^4.0", + "symfony/expression-language": "^2.6|^3.0", "symfony/filesystem": "^2.1", - "symfony/form": "~2.1", - "symfony/translation": "^2.1", - "symfony/validator": "^2.2", - "symfony/yaml": "^2.1", + "symfony/form": "~2.1|^3.0", + "symfony/translation": "^2.1|^3.0", + "symfony/validator": "^2.2|^3.0", + "symfony/yaml": "^2.1|^3.0", "twig/twig": "~1.12|~2.0" }, "suggest": { + "doctrine/cache": "Required if you like to use cache functionality.", + "doctrine/collections": "Required if you like to use doctrine collection types as ArrayCollection.", "symfony/yaml": "Required if you'd like to serialize data to YAML format." }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-1.x": "1.14-dev" } }, "autoload": { @@ -526,12 +709,16 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache2" + "MIT" ], "authors": [ { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" } ], "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.", @@ -543,7 +730,11 @@ "serialization", "xml" ], - "time": "2016-11-13T10:20:11+00:00" + "support": { + "issues": "https://github.com/schmittjoh/serializer/issues", + "source": "https://github.com/schmittjoh/serializer/tree/1.14.1" + }, + "time": "2020-02-22T20:59:37+00:00" }, { "name": "phpcollection/phpcollection", @@ -591,47 +782,56 @@ "sequence", "set" ], + "support": { + "issues": "https://github.com/schmittjoh/php-collection/issues", + "source": "https://github.com/schmittjoh/php-collection/tree/master" + }, "time": "2015-05-17T12:39:23+00:00" }, { "name": "phpoption/phpoption", - "version": "1.5.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed" + "reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/94e644f7d2051a5f0fcf77d81605f152eecff0ed", - "reference": "94e644f7d2051a5f0fcf77d81605f152eecff0ed", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/5455cb38aed4523f99977c4a12ef19da4bfe2a28", + "reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.0 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "4.7.*" + "bamarni/composer-bin-plugin": "^1.4.1", + "phpunit/phpunit": "^6.5.14 || ^7.0.20 || ^8.5.19 || ^9.5.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.8-dev" } }, "autoload": { - "psr-0": { - "PhpOption\\": "src/" + "psr-4": { + "PhpOption\\": "src/PhpOption/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache2" + "Apache-2.0" ], "authors": [ { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com" + }, + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk" } ], "description": "Option Type for PHP", @@ -641,7 +841,70 @@ "php", "type" ], - "time": "2015-07-25T16:39:46+00:00" + "support": { + "issues": "https://github.com/schmittjoh/php-option/issues", + "source": "https://github.com/schmittjoh/php-option/tree/1.8.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", + "type": "tidelift" + } + ], + "time": "2021-08-28T21:27:29+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "support": { + "source": "https://github.com/php-fig/cache/tree/master" + }, + "time": "2016-08-06T20:24:11+00:00" }, { "name": "psr/http-client", @@ -690,8 +953,66 @@ "psr", "psr-18" ], + "support": { + "source": "https://github.com/php-fig/http-client/tree/master" + }, "time": "2020-06-29T06:28:15+00:00" }, + { + "name": "psr/http-factory", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "reference": "12ac7fcd07e5b077433f5f2bee95b3a771bf61be", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "psr/http-message": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory/tree/master" + }, + "time": "2019-04-30T12:38:16+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -740,6 +1061,9 @@ "request", "response" ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/master" + }, "time": "2016-08-06T14:39:51+00:00" }, { @@ -780,43 +1104,120 @@ } ], "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-07-12T14:48:14+00:00" } ], "packages-dev": [ { "name": "myclabs/deep-copy", - "version": "1.5.5", + "version": "1.10.2", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108" + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/399c1f9781e222f6eb6cc238796f5200d1b7f108", - "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220", + "reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^7.1 || ^8.0" + }, + "replace": { + "myclabs/deep-copy": "self.version" }, "require-dev": { - "doctrine/collections": "1.*", - "phpunit/phpunit": "~4.1" + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" }, "type": "library", "autoload": { "psr-4": { "DeepCopy\\": "src/DeepCopy/" - } + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "Create deep copies (clones) of your objects", - "homepage": "https://github.com/myclabs/DeepCopy", "keywords": [ "clone", "copy", @@ -824,39 +1225,154 @@ "object", "object graph" ], - "time": "2016-10-31T17:19:45+00:00" + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.10.2" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2020-11-13T09:40:50+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/master" + }, + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/master" + }, + "time": "2018-07-08T19:19:57+00:00" }, { "name": "phpdocumentor/reflection-common", - "version": "1.0", + "version": "2.2.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c" + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/144c307535e82c8fdcaacbcfc1d6d8eeb896687c", - "reference": "144c307535e82c8fdcaacbcfc1d6d8eeb896687c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-2.x": "2.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -878,38 +1394,46 @@ "reflection", "static analysis" ], - "time": "2015-12-27T11:43:31+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.1", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", - "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/622548b623e81ca6d78b721c5e029f4ce664f170", + "reference": "622548b623e81ca6d78b721c5e029f4ce664f170", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0@dev", - "phpdocumentor/type-resolver": "^0.2.0", - "webmozart/assert": "^1.0" + "ext-filter": "*", + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.3", + "webmozart/assert": "^1.9.1" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^4.4" + "mockery/mockery": "~1.3.2", + "psalm/phar": "^4.8" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -920,44 +1444,50 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-09-30T07:12:33+00:00" + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.3.0" + }, + "time": "2021-10-19T17:43:47+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.2.1", + "version": "1.5.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb" + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", - "reference": "e224fb2ea2fba6d3ad6fdaef91cd09a172155ccb", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", "shasum": "" }, "require": { - "php": ">=5.5", - "phpdocumentor/reflection-common": "^1.0" + "php": "^7.2 || ^8.0", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "ext-tokenizer": "*", + "psalm/phar": "^4.8" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-1.x": "1.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -970,42 +1500,47 @@ "email": "me@mikevanriel.com" } ], - "time": "2016-11-25T06:54:22+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + }, + "time": "2021-10-02T14:08:47+00:00" }, { "name": "phpspec/prophecy", - "version": "v1.6.2", + "version": "1.14.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb" + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/6c52c2722f8460122f96f86346600e1077ce22cb", - "reference": "6c52c2722f8460122f96f86346600e1077ce22cb", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2", - "sebastian/comparator": "^1.1", - "sebastian/recursion-context": "^1.0|^2.0" + "doctrine/instantiator": "^1.2", + "php": "^7.2 || ~8.0, <8.2", + "phpdocumentor/reflection-docblock": "^5.2", + "sebastian/comparator": "^3.0 || ^4.0", + "sebastian/recursion-context": "^3.0 || ^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.0", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpspec/phpspec": "^6.0 || ^7.0", + "phpunit/phpunit": "^8.0 || ^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { - "psr-0": { - "Prophecy\\": "src/" + "psr-4": { + "Prophecy\\": "src/Prophecy" } }, "notification-url": "https://packagist.org/downloads/", @@ -1033,44 +1568,48 @@ "spy", "stub" ], - "time": "2016-11-21T14:58:47+00:00" + "support": { + "issues": "https://github.com/phpspec/prophecy/issues", + "source": "https://github.com/phpspec/prophecy/tree/1.14.0" + }, + "time": "2021-09-10T09:02:12+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "4.0.4", + "version": "6.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c14196e64a78570034afd0b7a9f3757ba71c2a0a" + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c14196e64a78570034afd0b7a9f3757ba71c2a0a", - "reference": "c14196e64a78570034afd0b7a9f3757ba71c2a0a", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0", - "phpunit/php-file-iterator": "~1.3", - "phpunit/php-text-template": "~1.2", - "phpunit/php-token-stream": "^1.4.2", - "sebastian/code-unit-reverse-lookup": "~1.0", - "sebastian/environment": "^1.3.2 || ^2.0", - "sebastian/version": "~1.0|~2.0" + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "^5.4" + "phpunit/phpunit": "^7.0" }, "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.4.0", - "ext-xmlwriter": "*" + "ext-xdebug": "^2.6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "6.1-dev" } }, "autoload": { @@ -1085,7 +1624,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1096,29 +1635,36 @@ "testing", "xunit" ], - "time": "2016-12-20T15:22:42+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + }, + "time": "2018-10-31T16:06:48+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/28af674ff175d0768a5a978e6de83f697d4a7f05", + "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1133,7 +1679,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1143,7 +1689,17 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-19T06:46:01+00:00" }, { "name": "phpunit/php-text-template", @@ -1184,29 +1740,38 @@ "keywords": [ "template" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/1.2.1" + }, "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", - "version": "1.0.8", + "version": "2.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260" + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/38e9124049cf1a164f1e4537caf19c99bf1eb260", - "reference": "38e9124049cf1a164f1e4537caf19c99bf1eb260", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/2454ae1765516d20c4ffe103d85a58a9a3bd5662", + "reference": "2454ae1765516d20c4ffe103d85a58a9a3bd5662", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "~4|~5" + "phpunit/phpunit": "^8.5" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -1219,7 +1784,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1228,33 +1793,43 @@ "keywords": [ "timer" ], - "time": "2016-05-12T18:03:57+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "source": "https://github.com/sebastianbergmann/php-timer/tree/2.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:20:02+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.9", + "version": "3.1.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b" + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3b402f65a4cc90abf6e1104e388b896ce209631b", - "reference": "3b402f65a4cc90abf6e1104e388b896ce209631b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", + "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.3" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1277,56 +1852,68 @@ "keywords": [ "tokenizer" ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], "abandoned": true, - "time": "2016-11-15T14:06:22+00:00" + "time": "2021-07-26T12:15:06+00:00" }, { "name": "phpunit/phpunit", - "version": "5.7.4", + "version": "7.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "af91da3f2671006ff5d0628023de3b7ac4d1ef09" + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/af91da3f2671006ff5d0628023de3b7ac4d1ef09", - "reference": "af91da3f2671006ff5d0628023de3b7ac4d1ef09", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", "shasum": "" }, "require": { + "doctrine/instantiator": "^1.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "~1.3", - "php": "^5.6 || ^7.0", - "phpspec/prophecy": "^1.6.2", - "phpunit/php-code-coverage": "^4.0.3", - "phpunit/php-file-iterator": "~1.4", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "^1.0.6", - "phpunit/phpunit-mock-objects": "^3.2", - "sebastian/comparator": "~1.2.2", - "sebastian/diff": "~1.2", - "sebastian/environment": "^1.3.4 || ^2.0", - "sebastian/exporter": "~2.0", - "sebastian/global-state": "^1.0 || ^2.0", - "sebastian/object-enumerator": "~2.0", - "sebastian/resource-operations": "~1.0", - "sebastian/version": "~1.0|~2.0", - "symfony/yaml": "~2.1|~3.0" + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" }, "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2" + "phpunit/phpunit-mock-objects": "*" }, "require-dev": { "ext-pdo": "*" }, "suggest": { + "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "~1.1" + "phpunit/php-invoker": "^2.0" }, "bin": [ "phpunit" @@ -1334,7 +1921,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "7.5-dev" } }, "autoload": { @@ -1360,87 +1947,31 @@ "testing", "xunit" ], - "time": "2016-12-13T16:19:44+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "3.4.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "reference": "3ab72b65b39b491e0c011e2e09bb2206c2aa8e24", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.6 || ^7.0", - "phpunit/php-text-template": "^1.2", - "sebastian/exporter": "^1.2 || ^2.0" - }, - "conflict": { - "phpunit/phpunit": "<5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4" - }, - "suggest": { - "ext-soap": "*" + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "abandoned": true, - "time": "2016-12-08T20:27:08+00:00" + "time": "2020-01-08T08:45:45+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.0", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe" + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/c36f5e7cfce482fde5bf8d10d41a53591e0198fe", - "reference": "c36f5e7cfce482fde5bf8d10d41a53591e0198fe", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/1de8cd5c010cb153fcd68b8d0f64606f523f7619", + "reference": "1de8cd5c010cb153fcd68b8d0f64606f523f7619", "shasum": "" }, "require": { "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { @@ -1465,34 +1996,44 @@ ], "description": "Looks up which function or method a line of code belongs to", "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2016-02-13T06:45:14+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/1.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:15:22+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f" + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/6a1ed12e8b2409076ab22e3897126211ff8b1f7f", - "reference": "6a1ed12e8b2409076ab22e3897126211ff8b1f7f", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1071dfcef776a57013124ff35e1fc41ccd294758", + "reference": "1071dfcef776a57013124ff35e1fc41ccd294758", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2 || ~2.0" + "php": ">=7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1505,6 +2046,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1516,45 +2061,52 @@ { "name": "Bernhard Schussek", "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" } ], "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", + "homepage": "https://github.com/sebastianbergmann/comparator", "keywords": [ "comparator", "compare", "equality" ], - "time": "2016-11-19T09:18:40+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "source": "https://github.com/sebastianbergmann/comparator/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T08:04:30+00:00" }, { "name": "sebastian/diff", - "version": "1.4.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e" + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/13edfd8706462032c2f52b4b862974dd46b71c9e", - "reference": "13edfd8706462032c2f52b4b862974dd46b71c9e", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/14f72dd46eaf2f2293cbe79c93cc0bc43161a211", + "reference": "14f72dd46eaf2f2293cbe79c93cc0bc43161a211", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.4-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -1567,46 +2119,62 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" } ], "description": "Diff implementation", "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ - "diff" + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "source": "https://github.com/sebastianbergmann/diff/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } ], - "time": "2015-12-08T07:14:41+00:00" + "time": "2020-11-30T07:59:04+00:00" }, { "name": "sebastian/environment", - "version": "2.0.0", + "version": "4.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", - "reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", + "reference": "d47bbbad83711771f167c72d4e3f25f7fcc1f8b0", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "4.2-dev" } }, "autoload": { @@ -1631,34 +2199,44 @@ "environment", "hhvm" ], - "time": "2016-11-26T07:53:53+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "source": "https://github.com/sebastianbergmann/environment/tree/4.2.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:53:42+00:00" }, { "name": "sebastian/exporter", - "version": "2.0.0", + "version": "3.1.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4" + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", - "reference": "ce474bdd1a34744d7ac5d6aad3a46d48d9bac4c4", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", + "reference": "0c32ea2e40dbf59de29f3b49bf375176ce7dd8db", "shasum": "" }, "require": { - "php": ">=5.3.3", - "sebastian/recursion-context": "~2.0" + "php": ">=7.0", + "sebastian/recursion-context": "^3.0" }, "require-dev": { "ext-mbstring": "*", - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^8.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.1.x-dev" } }, "autoload": { @@ -1671,6 +2249,10 @@ "BSD-3-Clause" ], "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, { "name": "Jeff Welch", "email": "whatthejeff@gmail.com" @@ -1679,17 +2261,13 @@ "name": "Volker Dusch", "email": "github@wallbash.com" }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, { "name": "Adam Harvey", "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" } ], "description": "Provides the functionality to export PHP variables for visualization", @@ -1698,27 +2276,37 @@ "export", "exporter" ], - "time": "2016-11-19T08:54:04+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "source": "https://github.com/sebastianbergmann/exporter/tree/3.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-11-11T13:51:24+00:00" }, { "name": "sebastian/global-state", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", - "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^6.0" }, "suggest": { "ext-uopz": "*" @@ -1726,7 +2314,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1749,33 +2337,38 @@ "keywords": [ "global state" ], - "time": "2015-10-12T03:26:01+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" + }, + "time": "2017-04-27T15:39:26+00:00" }, { "name": "sebastian/object-enumerator", - "version": "2.0.0", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35" + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", - "reference": "96f8a3f257b69e8128ad74d3a7fd464bcbaa3b35", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", + "reference": "e67f6d32ebd0c749cf9d1dbd9f226c727043cdf2", "shasum": "" }, "require": { - "php": ">=5.6", - "sebastian/recursion-context": "~2.0" + "php": ">=7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "~5" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1795,32 +2388,97 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-11-19T07:35:10+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/3.0.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:40:27+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "reference": "9b8772b9cbd456ab45d4a598d2dd1a1bced6363d", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/1.1.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:37:18+00:00" }, { "name": "sebastian/recursion-context", - "version": "2.0.0", + "version": "3.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a" + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/2c3ba150cbec723aa057506e73a8d33bdb286c9a", - "reference": "2c3ba150cbec723aa057506e73a8d33bdb286c9a", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/367dcba38d6e1977be014dc4b22f47a484dac7fb", + "reference": "367dcba38d6e1977be014dc4b22f47a484dac7fb", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "autoload": { @@ -1833,14 +2491,14 @@ "BSD-3-Clause" ], "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, { "name": "Sebastian Bergmann", "email": "sebastian@phpunit.de" }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, { "name": "Adam Harvey", "email": "aharvey@php.net" @@ -1848,29 +2506,39 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-11-19T07:33:16+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:34:24+00:00" }, { "name": "sebastian/resource-operations", - "version": "1.0.0", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/31d35ca87926450c44eae7e2611d45a7a65ea8b3", + "reference": "31d35ca87926450c44eae7e2611d45a7a65ea8b3", "shasum": "" }, "require": { - "php": ">=5.6.0" + "php": ">=7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -1890,7 +2558,18 @@ ], "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" + "support": { + "issues": "https://github.com/sebastianbergmann/resource-operations/issues", + "source": "https://github.com/sebastianbergmann/resource-operations/tree/2.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "abandoned": true, + "time": "2020-11-30T07:30:19+00:00" }, { "name": "sebastian/version", @@ -1933,43 +2612,48 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "source": "https://github.com/sebastianbergmann/version/tree/master" + }, "time": "2016-10-03T07:35:21+00:00" }, { - "name": "symfony/yaml", - "version": "v3.2.1", + "name": "symfony/polyfill-ctype", + "version": "v1.23.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "a7095af4b97a0955f85c8989106c249fa649011f" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/a7095af4b97a0955f85c8989106c249fa649011f", - "reference": "a7095af4b97a0955f85c8989106c249fa649011f", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", "shasum": "" }, "require": { - "php": ">=5.5.9" - }, - "require-dev": { - "symfony/console": "~2.8|~3.0" + "php": ">=7.1" }, "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-main": "1.23-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "Symfony\\Polyfill\\Ctype\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1978,43 +2662,120 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Yaml Component", + "description": "Symfony polyfill for ctype functions", "homepage": "https://symfony.com", - "time": "2016-12-10T10:07:06+00:00" + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-02-19T12:13:01+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", + "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2021-07-28T10:34:58+00:00" }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.10.0", "source": { "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "url": "https://github.com/webmozarts/assert.git", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^7.2 || ^8.0", + "symfony/polyfill-ctype": "^1.8" + }, + "conflict": { + "phpstan/phpstan": "<0.12.20", + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^8.5.13" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.10-dev" } }, "autoload": { @@ -2038,7 +2799,11 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/1.10.0" + }, + "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], @@ -2049,5 +2814,6 @@ "platform": { "php": "^7.2" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.1.0" } From 049e6347794fe97986c5114b0f0b7793ec9d6a71 Mon Sep 17 00:00:00 2001 From: Otto Kilpirinne Date: Wed, 24 Nov 2021 07:48:36 +0200 Subject: [PATCH 56/58] filter class for salesinvoices --- .../Netvisor/Filter/SalesInvoicesFilter.php | 31 ++++++++++ library/Xi/Netvisor/Netvisor.php | 13 ++-- .../Filter/SalesInvoicesFilterTest.php | 60 +++++++++++++++++++ tests/Xi/Netvisor/NetvisorTest.php | 7 ++- 4 files changed, 102 insertions(+), 9 deletions(-) create mode 100644 library/Xi/Netvisor/Filter/SalesInvoicesFilter.php create mode 100644 tests/Xi/Netvisor/Filter/SalesInvoicesFilterTest.php diff --git a/library/Xi/Netvisor/Filter/SalesInvoicesFilter.php b/library/Xi/Netvisor/Filter/SalesInvoicesFilter.php new file mode 100644 index 0000000..c34c735 --- /dev/null +++ b/library/Xi/Netvisor/Filter/SalesInvoicesFilter.php @@ -0,0 +1,31 @@ +lastmodifiedstart = $date->format('Y-m-d'); + } + + public function setGreaterThanId(int $id) + { + $this->invoicesabovenetvisorkey = $id; + } +} diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index bd6a6de..6d62acb 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -10,6 +10,7 @@ use Xi\Netvisor\Component\Validate; use Xi\Netvisor\Resource\Xml\Component\Root; use JMS\Serializer\Serializer; +use Xi\Netvisor\Filter\SalesInvoicesFilter; use Xi\Netvisor\Resource\Xml\Customer; use Xi\Netvisor\Resource\Xml\SalesInvoice; use Xi\Netvisor\Resource\Xml\PurchaseInvoice; @@ -231,20 +232,16 @@ public function getSalesInvoice($id) } /** - * Get sales invoices by last time modified and invoices above Netvisor key + * Get sales invoices by filters * - * @param dateTime $modifiedAfterDate - * @param int $invoiceId + * @param SalesInvoicesFilter $salesInvoicesFilter * @return null|string */ - public function getSalesInvoices(\DateTime $modifiedAfterDate, int $invoiceId) + public function getSalesInvoices(SalesInvoicesFilter $salesInvoicesFilter) { return $this->get( 'getsalesinvoice', - [ - 'lastmodifiedstart' => $modifiedAfterDate->format('Y-m-d'), - 'invoicesabovenetvisorkey' => $invoiceId, - ] + $salesInvoicesFilter->getFilterArray() ); } diff --git a/tests/Xi/Netvisor/Filter/SalesInvoicesFilterTest.php b/tests/Xi/Netvisor/Filter/SalesInvoicesFilterTest.php new file mode 100644 index 0000000..abb0870 --- /dev/null +++ b/tests/Xi/Netvisor/Filter/SalesInvoicesFilterTest.php @@ -0,0 +1,60 @@ +setModifiedAfterDate($datetime); + } + + if ($setInvoiceAboveId) { + $filter->setGreaterThanId($id); + } + + $filters = $filter->getFilterArray(); + $this->assertCount($count, $filters); + } + + public function provider() + { + return [ + [ + 'setId' => true, + 'setInvoicesAboveId' => true, + 'count' => 2, + ], + [ + 'setId' => false, + 'setInvoicesAboveId' => true, + 'count' => 1, + ], + [ + 'setId' => true, + 'setInvoicesAboveId' => false, + 'count' => 1, + ], + [ + 'setId' => false, + 'setInvoicesAboveId' => false, + 'count' => 0, + ], + ]; + } + + + +} diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 8af7b0a..9c1004d 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -13,6 +13,7 @@ use GuzzleHttp\Psr7\Response; use PHPUnit\Framework\TestCase; use Xi\Netvisor\Exception\NetvisorException; +use Xi\Netvisor\Filter\SalesInvoicesFilter; use Xi\Netvisor\Resource\Xml\PurchaseInvoice; use Xi\Netvisor\Resource\Xml\PurchaseInvoiceState; @@ -399,6 +400,10 @@ public function testGetSalesInvoices() $date = new \DateTime('2000-01-01'); $lastInvoiceId = 200; + $filter = new SalesInvoicesFilter(); + $filter->setGreaterThanId($lastInvoiceId); + $filter->setModifiedAfterDate($date); + // @var Netvisor $netvisorMock $netvisorMock = $this ->getMockBuilder(Netvisor::class) @@ -417,6 +422,6 @@ public function testGetSalesInvoices() ] ); - $netvisorMock->getSalesInvoices($date, $lastInvoiceId); + $netvisorMock->getSalesInvoices($filter); } } From 6c0c7cfaaafc633dc5abb704268c1d6f74a1426e Mon Sep 17 00:00:00 2001 From: Otto Kilpirinne Date: Thu, 25 Nov 2021 10:47:04 +0200 Subject: [PATCH 57/58] change method name to correct one --- library/Xi/Netvisor/Netvisor.php | 2 +- tests/Xi/Netvisor/NetvisorTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/Xi/Netvisor/Netvisor.php b/library/Xi/Netvisor/Netvisor.php index 6d62acb..f336ebc 100644 --- a/library/Xi/Netvisor/Netvisor.php +++ b/library/Xi/Netvisor/Netvisor.php @@ -240,7 +240,7 @@ public function getSalesInvoice($id) public function getSalesInvoices(SalesInvoicesFilter $salesInvoicesFilter) { return $this->get( - 'getsalesinvoice', + 'salesinvoicelist', $salesInvoicesFilter->getFilterArray() ); } diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 9c1004d..59ca173 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -415,7 +415,7 @@ public function testGetSalesInvoices() ->expects($this->once()) ->method('get') ->with( - 'getsalesinvoice', + 'salesinvoicelist', [ 'lastmodifiedstart' => $date->format('Y-m-d'), 'invoicesabovenetvisorkey' => $lastInvoiceId, From 436c4e44b92589f2d90851ae5c84190ce31acc0a Mon Sep 17 00:00:00 2001 From: Jaakko Mantila Date: Thu, 24 Feb 2022 10:01:13 +0200 Subject: [PATCH 58/58] Added support for php 8 --- composer.json | 6 +- composer.lock | 636 +++++++++--------- .../Naming/LowercaseNamingStrategy.php | 2 +- tests/Xi/Netvisor/Component/RequestTest.php | 2 +- tests/Xi/Netvisor/Component/ValidateTest.php | 2 +- tests/Xi/Netvisor/NetvisorTest.php | 6 +- .../Xi/Netvisor/Resource/Xml/CustomerTest.php | 2 +- .../Xml/PurchaseInvoiceAttachmentTest.php | 2 +- .../Resource/Xml/PurchaseInvoiceLineTest.php | 2 +- .../Resource/Xml/PurchaseInvoiceStateTest.php | 2 +- .../Resource/Xml/PurchaseInvoiceTest.php | 2 +- .../Xml/SalesInvoiceProductLineTest.php | 2 +- .../Resource/Xml/SalesInvoiceTest.php | 2 +- .../Netvisor/Resource/Xml/VoucherLineTest.php | 2 +- .../Xi/Netvisor/Resource/Xml/VoucherTest.php | 2 +- .../Naming/LowercaseNamingStrategyTest.php | 2 +- tests/Xi/Netvisor/XmlTestCase.php | 2 +- 17 files changed, 328 insertions(+), 348 deletions(-) diff --git a/composer.json b/composer.json index 0f8e099..0feff49 100644 --- a/composer.json +++ b/composer.json @@ -19,13 +19,13 @@ ], "require": { - "php": "^7.2", - "jms/serializer": "^1.4", + "php": ">=7.2", + "jms/serializer": "^3.11", "guzzlehttp/guzzle": "^7.2" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index 7a943b3..dd853dd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "f65b59ac2ac55c29f4b058bdebb2ab8e", + "content-hash": "7e15a82098bceb6bf70ae2daa038de23", "packages": [ { "name": "doctrine/annotations", @@ -149,32 +149,28 @@ }, { "name": "doctrine/lexer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042" + "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/e864bbf5904cb8f5bb334f99209b48018522f042", - "reference": "e864bbf5904cb8f5bb334f99209b48018522f042", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", + "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^8.2" + "doctrine/coding-standard": "^9.0", + "phpstan/phpstan": "1.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.11" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\Lexer\\": "lib/Doctrine/Common/Lexer" @@ -209,7 +205,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.1" + "source": "https://github.com/doctrine/lexer/tree/1.2.2" }, "funding": [ { @@ -225,20 +221,20 @@ "type": "tidelift" } ], - "time": "2020-05-25T17:44:05+00:00" + "time": "2022-01-12T08:27:12+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.4.0", + "version": "7.4.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "868b3571a039f0ebc11ac8f344f4080babe2cb94" + "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/868b3571a039f0ebc11ac8f344f4080babe2cb94", - "reference": "868b3571a039f0ebc11ac8f344f4080babe2cb94", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ee0a041b1760e6a53d2a39c8c34115adc2af2c79", + "reference": "ee0a041b1760e6a53d2a39c8c34115adc2af2c79", "shasum": "" }, "require": { @@ -247,7 +243,7 @@ "guzzlehttp/psr7": "^1.8.3 || ^2.1", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", - "symfony/deprecation-contracts": "^2.2" + "symfony/deprecation-contracts": "^2.2 || ^3.0" }, "provide": { "psr/http-client-implementation": "1.0" @@ -271,12 +267,12 @@ } }, "autoload": { - "psr-4": { - "GuzzleHttp\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -333,7 +329,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.4.0" + "source": "https://github.com/guzzle/guzzle/tree/7.4.1" }, "funding": [ { @@ -349,7 +345,7 @@ "type": "tidelift" } ], - "time": "2021-10-18T09:52:00+00:00" + "time": "2021-12-06T18:43:05+00:00" }, { "name": "guzzlehttp/promises", @@ -378,12 +374,12 @@ } }, "autoload": { - "psr-4": { - "GuzzleHttp\\Promise\\": "src/" - }, "files": [ "src/functions_include.php" - ] + ], + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -552,33 +548,38 @@ }, { "name": "jms/metadata", - "version": "1.7.0", + "version": "2.6.1", "source": { "type": "git", "url": "https://github.com/schmittjoh/metadata.git", - "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8" + "reference": "c3a3214354b5a765a19875f7b7c5ebcd94e462e5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/e5854ab1aa643623dc64adde718a8eec32b957a8", - "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/c3a3214354b5a765a19875f7b7c5ebcd94e462e5", + "reference": "c3a3214354b5a765a19875f7b7c5ebcd94e462e5", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": "^7.2|^8.0" }, "require-dev": { - "doctrine/cache": "~1.0", - "symfony/cache": "~3.1" + "doctrine/cache": "^1.0", + "doctrine/coding-standard": "^8.0", + "mikey179/vfsstream": "^1.6.7", + "phpunit/phpunit": "^8.5|^9.0", + "psr/container": "^1.0", + "symfony/cache": "^3.1|^4.0|^5.0", + "symfony/dependency-injection": "^3.1|^4.0|^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.5.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { - "psr-0": { + "psr-4": { "Metadata\\": "src/" } }, @@ -587,13 +588,13 @@ "MIT" ], "authors": [ - { - "name": "Asmir Mustafic", - "email": "goetas@gmail.com" - }, { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" } ], "description": "Class/method/property metadata management in PHP", @@ -605,106 +606,67 @@ ], "support": { "issues": "https://github.com/schmittjoh/metadata/issues", - "source": "https://github.com/schmittjoh/metadata/tree/1.x" - }, - "time": "2018-10-26T12:40:10+00:00" - }, - { - "name": "jms/parser-lib", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/parser-lib.git", - "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/parser-lib/zipball/c509473bc1b4866415627af0e1c6cc8ac97fa51d", - "reference": "c509473bc1b4866415627af0e1c6cc8ac97fa51d", - "shasum": "" - }, - "require": { - "phpoption/phpoption": ">=0.9,<2.0-dev" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "psr-0": { - "JMS\\": "src/" - } + "source": "https://github.com/schmittjoh/metadata/tree/2.6.1" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache2" - ], - "description": "A library for easily creating recursive-descent parsers.", - "support": { - "issues": "https://github.com/schmittjoh/parser-lib/issues", - "source": "https://github.com/schmittjoh/parser-lib/tree/1.0.0" - }, - "time": "2012-11-18T18:08:43+00:00" + "time": "2021-11-22T12:27:42+00:00" }, { "name": "jms/serializer", - "version": "1.14.1", + "version": "3.17.1", "source": { "type": "git", "url": "https://github.com/schmittjoh/serializer.git", - "reference": "ba908d278fff27ec01fb4349f372634ffcd697c0" + "reference": "190f64b051795d447ec755acbfdb1bff330a6707" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/ba908d278fff27ec01fb4349f372634ffcd697c0", - "reference": "ba908d278fff27ec01fb4349f372634ffcd697c0", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/190f64b051795d447ec755acbfdb1bff330a6707", + "reference": "190f64b051795d447ec755acbfdb1bff330a6707", "shasum": "" }, "require": { - "doctrine/annotations": "^1.0", + "doctrine/annotations": "^1.13", "doctrine/instantiator": "^1.0.3", - "jms/metadata": "^1.3", - "jms/parser-lib": "1.*", - "php": "^5.5|^7.0", - "phpcollection/phpcollection": "~0.1", - "phpoption/phpoption": "^1.1" - }, - "conflict": { - "twig/twig": "<1.12" + "doctrine/lexer": "^1.1", + "jms/metadata": "^2.6", + "php": "^7.2||^8.0", + "phpstan/phpdoc-parser": "^0.4 || ^0.5 || ^1.0" }, "require-dev": { + "doctrine/coding-standard": "^8.1", "doctrine/orm": "~2.1", + "doctrine/persistence": "^1.3.3|^2.0|^3.0", "doctrine/phpcr-odm": "^1.3|^2.0", "ext-pdo_sqlite": "*", "jackalope/jackalope-doctrine-dbal": "^1.1.5", - "phpunit/phpunit": "^4.8|^5.0", - "propel/propel1": "~1.7", + "ocramius/proxy-manager": "^1.0|^2.0", + "phpbench/phpbench": "^1.0", + "phpstan/phpstan": "^1.0.2", + "phpunit/phpunit": "^8.5.21||^9.0", "psr/container": "^1.0", - "symfony/dependency-injection": "^2.7|^3.3|^4.0", - "symfony/expression-language": "^2.6|^3.0", - "symfony/filesystem": "^2.1", - "symfony/form": "~2.1|^3.0", - "symfony/translation": "^2.1|^3.0", - "symfony/validator": "^2.2|^3.0", - "symfony/yaml": "^2.1|^3.0", - "twig/twig": "~1.12|~2.0" + "symfony/dependency-injection": "^3.0|^4.0|^5.0|^6.0", + "symfony/expression-language": "^3.2|^4.0|^5.0|^6.0", + "symfony/filesystem": "^3.0|^4.0|^5.0|^6.0", + "symfony/form": "^3.0|^4.0|^5.0|^6.0", + "symfony/translation": "^3.0|^4.0|^5.0|^6.0", + "symfony/validator": "^3.1.9|^4.0|^5.0|^6.0", + "symfony/yaml": "^3.3|^4.0|^5.0|^6.0", + "twig/twig": "~1.34|~2.4|^3.0" }, "suggest": { - "doctrine/cache": "Required if you like to use cache functionality.", "doctrine/collections": "Required if you like to use doctrine collection types as ArrayCollection.", - "symfony/yaml": "Required if you'd like to serialize data to YAML format." + "symfony/cache": "Required if you like to use cache functionality.", + "symfony/yaml": "Required if you'd like to use the YAML metadata format." }, "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.14-dev" + "dev-master": "3.x-dev" } }, "autoload": { - "psr-0": { - "JMS\\Serializer": "src/" + "psr-4": { + "JMS\\Serializer\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -732,147 +694,81 @@ ], "support": { "issues": "https://github.com/schmittjoh/serializer/issues", - "source": "https://github.com/schmittjoh/serializer/tree/1.14.1" - }, - "time": "2020-02-22T20:59:37+00:00" - }, - { - "name": "phpcollection/phpcollection", - "version": "0.5.0", - "source": { - "type": "git", - "url": "https://github.com/schmittjoh/php-collection.git", - "reference": "f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-collection/zipball/f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6", - "reference": "f2bcff45c0da7c27991bbc1f90f47c4b7fb434a6", - "shasum": "" - }, - "require": { - "phpoption/phpoption": "1.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.4-dev" - } - }, - "autoload": { - "psr-0": { - "PhpCollection": "src/" - } + "source": "https://github.com/schmittjoh/serializer/tree/3.17.1" }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache2" - ], - "authors": [ + "funding": [ { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com" + "url": "https://github.com/goetas", + "type": "github" } ], - "description": "General-Purpose Collection Library for PHP", - "keywords": [ - "collection", - "list", - "map", - "sequence", - "set" - ], - "support": { - "issues": "https://github.com/schmittjoh/php-collection/issues", - "source": "https://github.com/schmittjoh/php-collection/tree/master" - }, - "time": "2015-05-17T12:39:23+00:00" + "time": "2021-12-28T20:59:55+00:00" }, { - "name": "phpoption/phpoption", - "version": "1.8.0", + "name": "phpstan/phpdoc-parser", + "version": "1.2.0", "source": { "type": "git", - "url": "https://github.com/schmittjoh/php-option.git", - "reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28" + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "dbc093d7af60eff5cd575d2ed761b15ed40bd08e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/5455cb38aed4523f99977c4a12ef19da4bfe2a28", - "reference": "5455cb38aed4523f99977c4a12ef19da4bfe2a28", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/dbc093d7af60eff5cd575d2ed761b15ed40bd08e", + "reference": "dbc093d7af60eff5cd575d2ed761b15ed40bd08e", "shasum": "" }, "require": { - "php": "^7.0 || ^8.0" + "php": "^7.1 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.4.1", - "phpunit/phpunit": "^6.5.14 || ^7.0.20 || ^8.5.19 || ^9.5.8" + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.0", + "phpunit/phpunit": "^9.5", + "symfony/process": "^5.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.0-dev" } }, "autoload": { "psr-4": { - "PhpOption\\": "src/PhpOption/" + "PHPStan\\PhpDocParser\\": [ + "src/" + ] } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Johannes M. Schmitt", - "email": "schmittjoh@gmail.com" - }, - { - "name": "Graham Campbell", - "email": "hello@gjcampbell.co.uk" - } - ], - "description": "Option Type for PHP", - "keywords": [ - "language", - "option", - "php", - "type" + "MIT" ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { - "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.8.0" + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.2.0" }, - "funding": [ - { - "url": "https://github.com/GrahamCampbell", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/phpoption/phpoption", - "type": "tidelift" - } - ], - "time": "2021-08-28T21:27:29+00:00" + "time": "2021-09-16T20:46:02+00:00" }, { "name": "psr/cache", - "version": "1.0.1", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/php-fig/cache.git", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", - "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "url": "https://api.github.com/repos/php-fig/cache/zipball/aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", + "reference": "aa5030cfa5405eccfdcb1083ce040c2cb8d253bf", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { @@ -892,7 +788,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for caching libraries", @@ -902,9 +798,9 @@ "psr-6" ], "support": { - "source": "https://github.com/php-fig/cache/tree/master" + "source": "https://github.com/php-fig/cache/tree/3.0.0" }, - "time": "2016-08-06T20:24:11+00:00" + "time": "2021-02-03T23:26:27+00:00" }, { "name": "psr/http-client", @@ -1112,25 +1008,25 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.0", + "version": "v3.0.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", + "reference": "c726b64c1ccfe2896cb7df2e1331c357ad1c8ced", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "2.5-dev" + "dev-main": "3.0-dev" }, "thanks": { "name": "symfony/contracts", @@ -1159,7 +1055,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.0.0" }, "funding": [ { @@ -1175,7 +1071,7 @@ "type": "tidelift" } ], - "time": "2021-07-12T14:48:14+00:00" + "time": "2021-11-01T23:48:49+00:00" } ], "packages-dev": [ @@ -1196,9 +1092,6 @@ "require": { "php": "^7.1 || ^8.0" }, - "replace": { - "myclabs/deep-copy": "self.version" - }, "require-dev": { "doctrine/collections": "^1.0", "doctrine/common": "^2.6", @@ -1206,12 +1099,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, "files": [ "src/DeepCopy/deep_copy.php" - ] + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1239,28 +1132,29 @@ }, { "name": "phar-io/manifest", - "version": "1.0.3", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + "reference": "97803eca37d319dfa7826cc2437fc020857acb53" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", + "reference": "97803eca37d319dfa7826cc2437fc020857acb53", "shasum": "" }, "require": { "ext-dom": "*", "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.0" + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -1292,26 +1186,26 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/master" + "source": "https://github.com/phar-io/manifest/tree/2.0.3" }, - "time": "2018-07-08T19:23:20+00:00" + "time": "2021-07-20T11:28:43+00:00" }, { "name": "phar-io/version", - "version": "2.0.1", + "version": "3.2.1", "source": { "type": "git", "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^7.2 || ^8.0" }, "type": "library", "autoload": { @@ -1343,9 +1237,9 @@ "description": "Library for handling version information and constraints", "support": { "issues": "https://github.com/phar-io/version/issues", - "source": "https://github.com/phar-io/version/tree/master" + "source": "https://github.com/phar-io/version/tree/3.2.1" }, - "time": "2018-07-08T19:19:57+00:00" + "time": "2022-02-21T01:04:05+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -1459,16 +1353,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.5.1", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/93ebd0014cab80c4ea9f5e297ea48672f1b87706", + "reference": "93ebd0014cab80c4ea9f5e297ea48672f1b87706", "shasum": "" }, "require": { @@ -1503,22 +1397,22 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.6.0" }, - "time": "2021-10-02T14:08:47+00:00" + "time": "2022-01-04T19:58:01+00:00" }, { "name": "phpspec/prophecy", - "version": "1.14.0", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e" + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", - "reference": "d86dfc2e2a3cd366cee475e52c6bb3bbc371aa0e", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13", + "reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13", "shasum": "" }, "require": { @@ -1570,46 +1464,46 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/1.14.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.15.0" }, - "time": "2021-09-10T09:02:12+00:00" + "time": "2021-12-08T12:19:24+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "6.1.4", + "version": "7.0.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + "reference": "819f92bba8b001d4363065928088de22f25a3a48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", - "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/819f92bba8b001d4363065928088de22f25a3a48", + "reference": "819f92bba8b001d4363065928088de22f25a3a48", "shasum": "" }, "require": { "ext-dom": "*", "ext-xmlwriter": "*", - "php": "^7.1", - "phpunit/php-file-iterator": "^2.0", + "php": ">=7.2", + "phpunit/php-file-iterator": "^2.0.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0", + "phpunit/php-token-stream": "^3.1.3 || ^4.0", "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.1 || ^4.0", + "sebastian/environment": "^4.2.2", "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" + "theseer/tokenizer": "^1.1.3" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^8.2.2" }, "suggest": { - "ext-xdebug": "^2.6.0" + "ext-xdebug": "^2.7.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "6.1-dev" + "dev-master": "7.0-dev" } }, "autoload": { @@ -1637,22 +1531,28 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/master" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/7.0.15" }, - "time": "2018-10-31T16:06:48+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2021-07-26T12:20:09+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "2.0.4", + "version": "2.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05" + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/28af674ff175d0768a5a978e6de83f697d4a7f05", - "reference": "28af674ff175d0768a5a978e6de83f697d4a7f05", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", + "reference": "42c5ba5220e6904cbfe8b1a1bda7c0cfdc8c12f5", "shasum": "" }, "require": { @@ -1691,7 +1591,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", - "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.4" + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/2.0.5" }, "funding": [ { @@ -1699,7 +1599,7 @@ "type": "github" } ], - "time": "2021-07-19T06:46:01+00:00" + "time": "2021-12-02T12:42:26+00:00" }, { "name": "phpunit/php-text-template", @@ -1807,29 +1707,29 @@ }, { "name": "phpunit/php-token-stream", - "version": "3.1.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768" + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9c1da83261628cb24b6a6df371b6e312b3954768", - "reference": "9c1da83261628cb24b6a6df371b6e312b3954768", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/a853a0e183b9db7eed023d7933a858fa1c8d25a3", + "reference": "a853a0e183b9db7eed023d7933a858fa1c8d25a3", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=7.1" + "php": "^7.3 || ^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.0" + "phpunit/phpunit": "^9.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -1854,7 +1754,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/php-token-stream/issues", - "source": "https://github.com/sebastianbergmann/php-token-stream/tree/3.1.3" + "source": "https://github.com/sebastianbergmann/php-token-stream/tree/master" }, "funding": [ { @@ -1863,57 +1763,56 @@ } ], "abandoned": true, - "time": "2021-07-26T12:15:06+00:00" + "time": "2020-08-04T08:28:15+00:00" }, { "name": "phpunit/phpunit", - "version": "7.5.20", + "version": "8.5.23", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" + "reference": "efb20ff3623b9d09bf190a68fdfe574538a8d496" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", - "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/efb20ff3623b9d09bf190a68fdfe574538a8d496", + "reference": "efb20ff3623b9d09bf190a68fdfe574538a8d496", "shasum": "" }, "require": { - "doctrine/instantiator": "^1.1", + "doctrine/instantiator": "^1.3.1", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-xml": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.1", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^6.0.7", - "phpunit/php-file-iterator": "^2.0.1", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.10.0", + "phar-io/manifest": "^2.0.3", + "phar-io/version": "^3.0.2", + "php": ">=7.2", + "phpspec/prophecy": "^1.10.3", + "phpunit/php-code-coverage": "^7.0.12", + "phpunit/php-file-iterator": "^2.0.4", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.0", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", + "phpunit/php-timer": "^2.1.2", + "sebastian/comparator": "^3.0.2", + "sebastian/diff": "^3.0.2", + "sebastian/environment": "^4.2.3", + "sebastian/exporter": "^3.1.2", + "sebastian/global-state": "^3.0.0", "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", + "sebastian/resource-operations": "^2.0.1", + "sebastian/type": "^1.1.3", "sebastian/version": "^2.0.1" }, - "conflict": { - "phpunit/phpunit-mock-objects": "*" - }, "require-dev": { "ext-pdo": "*" }, "suggest": { "ext-soap": "*", "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" + "phpunit/php-invoker": "^2.0.0" }, "bin": [ "phpunit" @@ -1921,7 +1820,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "7.5-dev" + "dev-master": "8.5-dev" } }, "autoload": { @@ -1949,9 +1848,19 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/7.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/8.5.23" }, - "time": "2020-01-08T08:45:45+00:00" + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-01-21T05:50:34+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -2290,23 +2199,26 @@ }, { "name": "sebastian/global-state", - "version": "2.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/de036ec91d55d2a9e0db2ba975b512cdb1c23921", + "reference": "de036ec91d55d2a9e0db2ba975b512cdb1c23921", "shasum": "" }, "require": { - "php": "^7.0" + "php": ">=7.2", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "ext-dom": "*", + "phpunit/phpunit": "^8.0" }, "suggest": { "ext-uopz": "*" @@ -2314,7 +2226,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0-dev" + "dev-master": "3.0-dev" } }, "autoload": { @@ -2339,9 +2251,15 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/2.0.0" + "source": "https://github.com/sebastianbergmann/global-state/tree/3.0.2" }, - "time": "2017-04-27T15:39:26+00:00" + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2022-02-10T06:55:38+00:00" }, { "name": "sebastian/object-enumerator", @@ -2568,9 +2486,64 @@ "type": "github" } ], - "abandoned": true, "time": "2020-11-30T07:30:19+00:00" }, + { + "name": "sebastian/type", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "reference": "0150cfbc4495ed2df3872fb31b26781e4e077eb4", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "phpunit/phpunit": "^8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "source": "https://github.com/sebastianbergmann/type/tree/1.1.4" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2020-11-30T07:25:11+00:00" + }, { "name": "sebastian/version", "version": "2.0.1", @@ -2620,21 +2593,24 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.24.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "30885182c981ab175d4d034db0f6f469898070ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/30885182c981ab175d4d034db0f6f469898070ab", + "reference": "30885182c981ab175d4d034db0f6f469898070ab", "shasum": "" }, "require": { "php": ">=7.1" }, + "provide": { + "ext-ctype": "*" + }, "suggest": { "ext-ctype": "For best performance" }, @@ -2679,7 +2655,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" }, "funding": [ { @@ -2695,7 +2671,7 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2021-10-20T20:35:02+00:00" }, { "name": "theseer/tokenizer", @@ -2812,8 +2788,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.2" + "php": ">=7.2" }, "platform-dev": [], - "plugin-api-version": "2.1.0" + "plugin-api-version": "2.2.0" } diff --git a/library/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategy.php b/library/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategy.php index 6f08c28..ccc02b2 100644 --- a/library/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategy.php +++ b/library/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategy.php @@ -7,7 +7,7 @@ class LowercaseNamingStrategy implements PropertyNamingStrategyInterface { - public function translateName(PropertyMetadata $property) + public function translateName(PropertyMetadata $property): string { return strtolower($property->name); } diff --git a/tests/Xi/Netvisor/Component/RequestTest.php b/tests/Xi/Netvisor/Component/RequestTest.php index aa5c071..faeb1ff 100644 --- a/tests/Xi/Netvisor/Component/RequestTest.php +++ b/tests/Xi/Netvisor/Component/RequestTest.php @@ -21,7 +21,7 @@ class RequestTest extends TestCase */ private $client; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Component/ValidateTest.php b/tests/Xi/Netvisor/Component/ValidateTest.php index 71a9b17..e6ab097 100644 --- a/tests/Xi/Netvisor/Component/ValidateTest.php +++ b/tests/Xi/Netvisor/Component/ValidateTest.php @@ -13,7 +13,7 @@ class ValidateTest extends XmlTestCase */ private $validate; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/NetvisorTest.php b/tests/Xi/Netvisor/NetvisorTest.php index 59ca173..ae3fa05 100644 --- a/tests/Xi/Netvisor/NetvisorTest.php +++ b/tests/Xi/Netvisor/NetvisorTest.php @@ -37,7 +37,7 @@ class NetvisorTest extends TestCase /** * @test */ - public function setUp() + public function setUp(): void { $this->client = $this->getMockBuilder('GuzzleHttp\Client') ->disableOriginalConstructor() @@ -149,6 +149,10 @@ public function sendInvoiceSendsRequest() ->method('getDtdPath') ->will($this->returnValue(__DIR__ . '/Resource/Dtd/test.dtd')); + $invoice->expects($this->once()) + ->method('getSerializableObject') + ->will($this->returnValue([])); + $this->assertEquals('lus', $netvisor->sendInvoice($invoice)); } diff --git a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php index 869fece..bbc3580 100644 --- a/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/CustomerTest.php @@ -18,7 +18,7 @@ class CustomerTest extends XmlTestCase */ private $baseInformation; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php index 5594407..857971f 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceAttachmentTest.php @@ -11,7 +11,7 @@ class PurchaseInvoiceAttachmentTest extends XmlTestCase */ private $attachment; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLineTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLineTest.php index a315881..24549b2 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceLineTest.php @@ -12,7 +12,7 @@ class PurchaseInvoiceLineTest extends XmlTestCase */ private $invoiceLine; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceStateTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceStateTest.php index 458ba20..16b2d79 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceStateTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceStateTest.php @@ -11,7 +11,7 @@ class PurchaseInvoiceStateTest extends XmlTestCase */ private $invoiceState; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php index fae3991..e79f17f 100644 --- a/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/PurchaseInvoiceTest.php @@ -12,7 +12,7 @@ class PurchaseInvoiceTest extends XmlTestCase */ private $invoice; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php index 076a237..86dc2db 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceProductLineTest.php @@ -13,7 +13,7 @@ class SalesInvoiceProductLineTest extends XmlTestCase */ private $invoiceProductLine; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php index a57e07f..8c3a27e 100644 --- a/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/SalesInvoiceTest.php @@ -12,7 +12,7 @@ class SalesInvoiceTest extends XmlTestCase */ private $invoice; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php b/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php index b3b3c3d..65d3605 100644 --- a/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/VoucherLineTest.php @@ -12,7 +12,7 @@ class VoucherLineTest extends XmlTestCase */ private $voucherLine; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php index a94d41b..f31ebe7 100644 --- a/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php +++ b/tests/Xi/Netvisor/Resource/Xml/VoucherTest.php @@ -12,7 +12,7 @@ class VoucherTest extends XmlTestCase */ private $voucher; - public function setUp() + public function setUp(): void { parent::setUp(); diff --git a/tests/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategyTest.php b/tests/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategyTest.php index 064a95d..f25f276 100644 --- a/tests/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategyTest.php +++ b/tests/Xi/Netvisor/Serializer/Naming/LowercaseNamingStrategyTest.php @@ -20,7 +20,7 @@ public function lowercases($name) $toBeObject[$name] = ''; $object = (object)$toBeObject; - $metadata = new PropertyMetadata($object, $name); + $metadata = new PropertyMetadata($object::class, $name); $this->assertEquals(strtolower($name), $strategy->translateName($metadata)); } diff --git a/tests/Xi/Netvisor/XmlTestCase.php b/tests/Xi/Netvisor/XmlTestCase.php index a0d602f..974cd92 100644 --- a/tests/Xi/Netvisor/XmlTestCase.php +++ b/tests/Xi/Netvisor/XmlTestCase.php @@ -20,7 +20,7 @@ class XmlTestCase extends TestCase */ private $validate; - public function setUp() + public function setUp(): void { $builder = SerializerBuilder::create(); $builder->setPropertyNamingStrategy(new LowercaseNamingStrategy());