Skip to content

Commit c685994

Browse files
authored
Merge branch 'main' into add-phpstan
2 parents 8c3a137 + 05412be commit c685994

File tree

12 files changed

+354
-231
lines changed

12 files changed

+354
-231
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,4 +266,4 @@ Guzzle 6 and 7 is supported starting from v3. For Guzzle 3 use [v1](https://gith
266266

267267
## TODO
268268

269-
- Current entities do not contain all available properties. Feel free to submit a PR with added or extended entities if you require them. Use the ```userscript.js``` in greasemonkey or tampermonkey to generate entities consistently and completely.
269+
- Current entities do not contain all available properties. Feel free to submit a PR with added or extended entities if you require them.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
"ext-json": "*"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "^8.5|^9.3",
2524
"phpstan/phpstan": "^2.1"
25+
"phpunit/phpunit": "^9.6"
2626
},
2727
"autoload": {
2828
"psr-4": {

phpunit.xml.dist

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
bootstrap="./vendor/autoload.php"
4-
colors="true"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
bootstrap="./vendor/autoload.php"
5+
colors="true"
6+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd">
7+
8+
<coverage>
9+
<include>
10+
<directory suffix=".php">src</directory>
11+
</include>
12+
</coverage>
13+
614
<testsuites>
7-
<testsuite name="Application Test Suite">
15+
<testsuite name="Exact PHP Client Test Suite">
816
<directory>tests</directory>
917
</testsuite>
1018
</testsuites>
11-
<filter>
12-
<whitelist>
13-
<directory suffix=".php">src</directory>
14-
</whitelist>
15-
</filter>
1619
</phpunit>

src/Picqer/Financials/Exact/SyncDeleted.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @property string $DeletedDate Deleted date
1313
* @property int $Division Division code
1414
* @property string $EntityKey Entity key
15-
* @property int $EntityType Entity Types: 1= TransactionLines 2= Accounts 3= Addresses 4= Attachments 5= Contacts 6= Documents 7= GLAccounts 8= ItemPrices 9= Items 10= PaymentTerms 12= SalesOrders (This entity is going to be removed. Please refer to the new entity SalesOrderHeaders, SalesOrderLines.) 13= SalesInvoices 14= TimeCostTransactions 15= StockPositions 16= GoodsDeliveries 17= GoodsDeliveryLines 18= GLClassifications 19= ItemWarehouses 20= StorageLocationStockPositions 21= Projects 22= PurchaseOrders 23= Subscriptions 24= SubscriptionLines 25= ProjectWBS 26= ProjectPlanning 27= LeaveAbsenceHoursByDay 28= SerialBatchNumbers 29= StockSerialBatchNumbers 30= ItemAccounts 31= DiscountTables 32= SalesOrderHeaders 33= SalesOrderLines 34= QuotationHeaders 35= QuotationLines 36= ShopOrders 37= ShopOrderMaterialPlans 38= ShopOrderRoutingStepPlans 39= Schedules 40= ScheduleEntries 41= ItemStorageLocations 42= Employees 43= Employments 44= EmploymentContracts 45= EmploymentOrganizations 46= EmploymentCLAs 47= EmploymentSalaries 48= BankAccounts 49= EmploymentTaxAuthoritiesGeneral 50= ShopOrderPurchasePlanning 51= ShopOrderSubOrders
15+
* @property int $EntityType Entity Types: 1= TransactionLines 2= Accounts 3= Addresses 4= Attachments 5= Contacts 6= Documents 7= GLAccounts 8= ItemPrices 9= Items 10= PaymentTerms 12= SalesOrders (This entity is going to be removed. Please refer to the new entity SalesOrderHeaders, SalesOrderLines.) 13= SalesInvoices 14= TimeCostTransactions 15= StockPositions 16= GoodsDeliveries 17= GoodsDeliveryLines 18= GLClassifications 19= ItemWarehouses 20= StorageLocationStockPositions 21= Projects 22= PurchaseOrders 23= Subscriptions 24= SubscriptionLines 25= ProjectWBS 26= ProjectPlanning 27= LeaveAbsenceHoursByDay 28= SerialBatchNumbers 29= StockSerialBatchNumbers 30= ItemAccounts 31= DiscountTables 32= SalesOrderHeaders 33= SalesOrderLines 34= QuotationHeaders 35= QuotationLines 36= ShopOrders 37= ShopOrderMaterialPlans 38= ShopOrderRoutingStepPlans 39= Schedules 40= ScheduleEntries 41= ItemStorageLocations 42= Employees 43= Employments 44= EmploymentContracts 45= EmploymentOrganizations 46= EmploymentCLAs 47= EmploymentSalaries 48= BankAccounts 49= EmploymentTaxAuthoritiesGeneral 50= ShopOrderPurchasePlanning 51= ShopOrderSubOrders 53= RequirementIssues 54= BillOfMaterialMaterials
1616
* @property string $ID Primary key
1717
*/
1818
class SyncDeleted extends Model

src/Picqer/Financials/Exact/SyncScheduleEntry.php

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,29 @@
88
* @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SyncHRMScheduleEntries
99
*
1010
* @property int $Timestamp Timestamp
11+
* @property bool $Break This property is for Schedule type 4 (Time frames per day). Set to true if there is break time else false.
12+
* @property string $BreakEndTime This is the break end time. This property is for Schedule type 4 (Time frames per day)
13+
* @property string $BreakStartTime This is the break start time. This property is for Schedule type 4 (Time frames per day)
1114
* @property string $Created Created date.
12-
* @property string $Creator ID of creator.
15+
* @property string $Creator User ID of creator.
1316
* @property string $CreatorFullName Name of creator
1417
* @property int $Day The day in the week. 0 - Monday; 1 - Tuesday; 2 - Wednesday; 3 - Thursday; 4 - Friday; 5 - Saturday; 6 - Sunday
18+
* @property bool $DayIsSelected This property is required for Schedule type 2 (Hours and specific days).
1519
* @property int $Division Division code
16-
* @property string $EndTime This is the end time of the schedule entry.
17-
* @property string $Hours The total number of hours for per day. Values is in 'HH:mm' format, eg : 08:00
20+
* @property string $Employee Identifier of the employee
21+
* @property string $EmployeeFullName Name of employee
22+
* @property string $Employment Employment ID
23+
* @property int $EmploymentNumber Employment number
24+
* @property string $EndTime This is the end time of the work day. This property is for Schedule type 4 (Time frames per day)
25+
* @property string $Hours Set the total number of hours for per day. This property is for Schedule type 3 (Hours per day). Values should be in 'HH:mm' format, eg : 08:00
1826
* @property string $ID Primary key
1927
* @property string $Modified Last modified date.
20-
* @property string $Modifier ID of modifier
28+
* @property string $Modifier User ID of modifier.
2129
* @property string $ModifierFullName Name of modifier
2230
* @property string $Schedule The id of the schedule linked to this schedule entry.
23-
* @property int $ScheduleActivityType The activity of the schedule entry. 0 - Work; 1 - Pause
24-
* @property string $StartTime This is the start time of the schedule entry.
25-
* @property int $WeekNumber This is the week number.
31+
* @property int $ScheduleType This is the schedule type id based on the Schedule. 1 - Hours and average days; 2 - Hours and specific days; 3 - Hours per day; 4 - Time frames per day
32+
* @property string $StartTime This is the start time of the work day. This property is for Schedule type 4 (Time frames per day)
33+
* @property int $WeekNumber This is the week number .
2634
*/
2735
class SyncScheduleEntry extends Model
2836
{
@@ -32,19 +40,27 @@ class SyncScheduleEntry extends Model
3240

3341
protected $fillable = [
3442
'Timestamp',
43+
'Break',
44+
'BreakEndTime',
45+
'BreakStartTime',
3546
'Created',
3647
'Creator',
3748
'CreatorFullName',
3849
'Day',
50+
'DayIsSelected',
3951
'Division',
52+
'Employee',
53+
'EmployeeFullName',
54+
'Employment',
55+
'EmploymentNumber',
4056
'EndTime',
4157
'Hours',
4258
'ID',
4359
'Modified',
4460
'Modifier',
4561
'ModifierFullName',
4662
'Schedule',
47-
'ScheduleActivityType',
63+
'ScheduleType',
4864
'StartTime',
4965
'WeekNumber',
5066
];
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
namespace Picqer\Financials\Exact;
4+
5+
/**
6+
* Class SyncShopOrderPurchasePlanning.
7+
*
8+
* @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SyncManufacturingShopOrderPurchasePlanning
9+
*
10+
* @property int $Timestamp Timestamp
11+
* @property string $Created Creation date
12+
* @property string $Creator User ID of creator
13+
* @property string $CreatorFullName Name of creator
14+
* @property int $Division Division code
15+
* @property float $Factor Factor
16+
* @property int $FactorType Conversion factor type between produced item and Subcontract purchase Unit
17+
* @property string $ID Primary key
18+
* @property string $Modified Last modified date
19+
* @property string $Modifier User ID of modifier
20+
* @property string $ModifierFullName Name of modifier
21+
* @property string $PurchaseOrder Reference to PurchaseOrderLines
22+
* @property int $PurchaseOrderNumber Number of the purchase order
23+
* @property float $Quantity Quantity
24+
* @property string $ShopOrder Reference to ShopOrders
25+
* @property string $ShopOrderMaterialPlan Reference to ShopOrderMaterialPlans
26+
* @property int $ShopOrderNumber Unique number to indentify the shop order
27+
* @property string $ShopOrderRoutingStepPlan Reference to ShopOrderRoutingStepPlans
28+
*/
29+
class SyncShopOrderPurchasePlanning extends Model
30+
{
31+
use Query\Findable;
32+
33+
protected $primaryKey = 'Timestamp';
34+
35+
protected $fillable = [
36+
'Timestamp',
37+
'Created',
38+
'Creator',
39+
'CreatorFullName',
40+
'Division',
41+
'Factor',
42+
'FactorType',
43+
'ID',
44+
'Modified',
45+
'Modifier',
46+
'ModifierFullName',
47+
'PurchaseOrder',
48+
'PurchaseOrderNumber',
49+
'Quantity',
50+
'ShopOrder',
51+
'ShopOrderMaterialPlan',
52+
'ShopOrderNumber',
53+
'ShopOrderRoutingStepPlan',
54+
];
55+
56+
protected $url = 'sync/Manufacturing/ShopOrderPurchasePlanning';
57+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
3+
namespace Picqer\Financials\Exact;
4+
5+
/**
6+
* Class SyncShopOrderSubOrder.
7+
*
8+
* @see https://start.exactonline.nl/docs/HlpRestAPIResourcesDetails.aspx?name=SyncManufacturingShopOrderSubOrders
9+
*
10+
* @property int $Timestamp Timestamp
11+
* @property string $Created Creation date
12+
* @property string $Creator User ID of creator
13+
* @property string $CreatorFullName Name of creator
14+
* @property int $Division Division code
15+
* @property string $ID Primary key
16+
* @property int $Level Level of the sub shop order within the shop order structure
17+
* @property string $Modified Last modified date
18+
* @property string $Modifier User ID of modifier
19+
* @property string $ModifierFullName Name of modifier
20+
* @property string $ShopOrder Reference to ShopOrders for the current shop order
21+
* @property string $ShopOrderMain Reference to ShopOrders for main shop order
22+
* @property int $ShopOrderMainNumber Number of main shop order
23+
* @property string $ShopOrderMaterialPlan Reference to ShopOrderMaterialPlans
24+
* @property int $ShopOrderNumber Number of the current shop order
25+
* @property string $ShopOrderParent Reference to ShopOrders for parent shop order
26+
* @property int $ShopOrderParentNumber Number of parent shop order
27+
*/
28+
class SyncShopOrderSubOrder extends Model
29+
{
30+
use Query\Findable;
31+
32+
protected $primaryKey = 'Timestamp';
33+
34+
protected $fillable = [
35+
'Timestamp',
36+
'Created',
37+
'Creator',
38+
'CreatorFullName',
39+
'Division',
40+
'ID',
41+
'Level',
42+
'Modified',
43+
'Modifier',
44+
'ModifierFullName',
45+
'ShopOrder',
46+
'ShopOrderMain',
47+
'ShopOrderMainNumber',
48+
'ShopOrderMaterialPlan',
49+
'ShopOrderNumber',
50+
'ShopOrderParent',
51+
'ShopOrderParentNumber',
52+
];
53+
54+
protected $url = 'sync/Manufacturing/ShopOrderSubOrders';
55+
}

tests/ConnectionTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,10 @@ public function testResponseIsLoggedIfAcquiringTokensFailed(): void
8989
$connection->get('crm/Accounts');
9090
}
9191

92-
public function endpointsThatDontUseDivisionInUrl(): array
92+
public function endpointsThatDontUseDivisionInUrl(): \Generator
9393
{
94-
return [
95-
'System users endpoint' => ['system/Users'],
96-
'Me endpoint' => ['current/Me'],
97-
];
94+
yield 'System users endpoint' => ['system/Users'];
95+
yield 'Me endpoint' => ['current/Me'];
9896
}
9997

10098
private function createMockHandler(): MockHandler

tests/ModelTest.php

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Picqer\Tests;
44

5-
use Generator;
65
use PHPUnit\Framework\TestCase;
76
use Picqer\Financials\Exact\Item;
87
use Picqer\Financials\Exact\Query\Resultset;
@@ -12,7 +11,7 @@ class ModelTest extends TestCase
1211
{
1312
use MocksExactConnection;
1413

15-
public function testCanFindModel()
14+
public function testCanFindModel(): void
1615
{
1716
$handler = $this->createMockHandlerUsingFixture('item.json');
1817
$connection = $this->createMockConnection($handler);
@@ -23,7 +22,7 @@ public function testCanFindModel()
2322
$this->assertEquals('00000000-0000-0000-0000-000000000000', $response->primaryKeyContent());
2423
}
2524

26-
public function testCanGetFirstModel()
25+
public function testCanGetFirstModel(): void
2726
{
2827
$handler = $this->createMockHandlerUsingFixture('item.json');
2928
$connection = $this->createMockConnection($handler);
@@ -34,7 +33,7 @@ public function testCanGetFirstModel()
3433
$this->assertEquals('00000000-0000-0000-0000-000000000000', $response->primaryKeyContent());
3534
}
3635

37-
public function testCanGetModels()
36+
public function testCanGetModels(): void
3837
{
3938
$handler = $this->createMockHandlerUsingFixture('items.json');
4039
$connection = $this->createMockConnection($handler);
@@ -45,18 +44,17 @@ public function testCanGetModels()
4544
$this->assertCount(2, $response);
4645
}
4746

48-
public function testCanGetModelsAsGenerator()
47+
public function testCanGetModelsAsGenerator(): void
4948
{
5049
$handler = $this->createMockHandlerUsingFixture('items.json');
5150
$connection = $this->createMockConnection($handler);
5251

5352
$response = (new Item($connection))->getAsGenerator();
5453

55-
$this->assertInstanceOf(Generator::class, $response);
56-
$this->assertCount(2, $response);
54+
$this->assertEquals(2, iterator_count($response));
5755
}
5856

59-
public function testCanFilterModels()
57+
public function testCanFilterModels(): void
6058
{
6159
$handler = $this->createMockHandlerUsingFixture('items.json');
6260
$connection = $this->createMockConnection($handler);
@@ -67,18 +65,17 @@ public function testCanFilterModels()
6765
$this->assertCount(2, $response);
6866
}
6967

70-
public function testCanFilterModelsAsGenerator()
68+
public function testCanFilterModelsAsGenerator(): void
7169
{
7270
$handler = $this->createMockHandlerUsingFixture('items.json');
7371
$connection = $this->createMockConnection($handler);
7472

7573
$response = (new Item($connection))->filterAsGenerator('IsWebshopItem eq 0');
7674

77-
$this->assertInstanceOf(Generator::class, $response);
78-
$this->assertCount(2, $response);
75+
$this->assertEquals(2, iterator_count($response));
7976
}
8077

81-
public function testCanGetCollectionFromResult()
78+
public function testCanGetCollectionFromResult(): void
8279
{
8380
$handler = $this->createMockHandlerUsingFixture('items.json');
8481
$connection = $this->createMockConnection($handler);
@@ -91,7 +88,7 @@ public function testCanGetCollectionFromResult()
9188
$this->assertCount(2, $collection);
9289
}
9390

94-
public function testCanGetCollectionFromResultAsGenerator()
91+
public function testCanGetCollectionFromResultAsGenerator(): void
9592
{
9693
$handler = $this->createMockHandlerUsingFixture('items.json');
9794
$connection = $this->createMockConnection($handler);
@@ -100,18 +97,16 @@ public function testCanGetCollectionFromResultAsGenerator()
10097
$result = $connection->get($item->url(), []);
10198
$collection = $item->collectionFromResultAsGenerator($result);
10299

103-
$this->assertInstanceOf(Generator::class, $collection);
104-
$this->assertCount(2, $collection);
100+
$this->assertEquals(2, iterator_count($collection));
105101
}
106102

107-
public function testCanGetResultSet()
103+
public function testCanGetResultSet(): void
108104
{
109105
$handler = $this->createMockHandler();
110106
$connection = $this->createMockConnection($handler);
111-
$item = new Item($connection);
112107

113-
$resultset = (new Item($connection))->getResultSet();
108+
$resultSet = (new Item($connection))->getResultSet();
114109

115-
$this->assertInstanceOf(Resultset::class, $resultset);
110+
$this->assertInstanceOf(Resultset::class, $resultSet);
116111
}
117112
}

0 commit comments

Comments
 (0)