Skip to content

Commit

Permalink
Merge pull request #12 from FriendsOfCXML/11-update-github-action
Browse files Browse the repository at this point in the history
Updated GA CI to avoid deprecation errors
  • Loading branch information
mathielen authored Feb 22, 2023
2 parents 410fefc + 8bb72cc commit fb6284d
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 30 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ jobs:
'7.4',
'8.0',
'8.1',
'8.2',
]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -35,10 +36,10 @@ jobs:
- name: Composer get cache directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Composer cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -55,7 +56,7 @@ jobs:
run: vendor/bin/parallel-lint src/

- name: Run CodeStyle checks
run: vendor/bin/php-cs-fixer fix src --allow-risky=yes --diff --dry-run
run: PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix src --allow-risky=yes --diff --dry-run

- name: Run PHPStan
run: vendor/bin/phpstan analyze -clear-result-cache -c phpstan.neon src/ -l 8 --no-progress --xdebug
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
"ext-dom": "*",
"ext-libxml": "*",
"beberlei/assert": "@stable",
"jms/serializer": "^3.17",
"jms/serializer": "^3.19.0",
"psr/log": "^1.0 || ^2.0 || ^3.0"
},
"suggest": {
"symfony/routing": "If you want to use SelfAwareProfileRequestHandler"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.6.0",
"friendsofphp/php-cs-fixer": "^3.8",
"php-parallel-lint/php-parallel-lint": "^1.3",
"phpunit/phpunit": "^9.6.3",
"phpstan/phpstan": "^1.10.1",
"friendsofphp/php-cs-fixer": "^v3.14.4",
"php-parallel-lint/php-parallel-lint": "^1.3.2",
"enlightn/security-checker": "^1.10",
"symfony/routing": "^4.4"
"symfony/routing": "^4.4.44"
},
"autoload": {
"psr-4": {
Expand Down
13 changes: 7 additions & 6 deletions tests/CXmlTest/Builder/OrderRequestBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,28 @@
*/
class OrderRequestBuilderTest extends TestCase implements PayloadIdentityFactoryInterface
{

public function testFromPunchOutOrderMessage(): void
{
$serializer = Serializer::create();
$poomXml = \file_get_contents(__DIR__ . '/fixtures/poom.xml');
$poomXml = \file_get_contents(__DIR__.'/fixtures/poom.xml');
$poom = $serializer->deserialize($poomXml);

$orb = OrderRequestBuilder::fromPunchOutOrderMessage($poom->getMessage()->getPayload());
$actualOrderRequest = $orb
->billTo('name')
->build();
->build()
;

$actualOrderRequest = Builder::create('cxml-php UserAgent', null, $this)
->payload($actualOrderRequest)
->from(new Credential('NetworkId', 'inbound@prominate-platform.com'))
->to(new Credential('NetworkId', 'supplier@supplier.com'))
->sender(new Credential('NetworkId', 'inbound@prominate-platform.com'))
->build();
->build()
;
$actualOrderRequest = $serializer->serialize($actualOrderRequest);

$expectedOrderRequest = \file_get_contents(__DIR__ . '/fixtures/order_request.xml');
$expectedOrderRequest = \file_get_contents(__DIR__.'/fixtures/order_request.xml');

$this->assertXmlStringEqualsXmlString($expectedOrderRequest, $actualOrderRequest);
}
Expand All @@ -48,4 +49,4 @@ public function newPayloadIdentity(): PayloadIdentity
new \DateTime('2021-01-08T23:00:06-08:00')
);
}
}
}
4 changes: 2 additions & 2 deletions tests/CXmlTest/Model/OrderRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public function testMinimumExample(): void
210
),
[
new Classification('custom', 0)
new Classification('custom', 0),
]
),
new \DateTime('2020-02-28')
Expand All @@ -129,7 +129,7 @@ public function testMinimumExample(): void
320
),
[
new Classification('custom', 0)
new Classification('custom', 0),
]
),
new \DateTime('2020-02-28')
Expand Down
4 changes: 2 additions & 2 deletions tests/CXmlTest/Model/PunchOutSetupRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class PunchOutSetupRequestTest extends TestCase implements PayloadIdentityFactor

protected function setUp(): void
{
$this->dtdValidator = new DtdValidator(__DIR__ . '/../../metadata/cxml/dtd/1.2.053/');
$this->dtdValidator = new DtdValidator(__DIR__.'/../../metadata/cxml/dtd/1.2.053/');
}

public function testMinimumExample(): void
Expand Down Expand Up @@ -131,7 +131,7 @@ public function testMinimumExample(): void

$this->dtdValidator->validateAgainstDtd($xml);

$this->assertXmlStringEqualsXmlFile(__DIR__ . '/../../metadata/cxml/samples/PunchOutSetupRequest.xml', $xml);
$this->assertXmlStringEqualsXmlFile(__DIR__.'/../../metadata/cxml/samples/PunchOutSetupRequest.xml', $xml);
}

public function newPayloadIdentity(): PayloadIdentity
Expand Down
10 changes: 5 additions & 5 deletions tests/CXmlTest/Model/PunchoutOrderMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class PunchoutOrderMessageTest extends TestCase implements PayloadIdentityFactor

protected function setUp(): void
{
$this->dtdValidator = new DtdValidator(__DIR__ . '/../../metadata/cxml/dtd/1.2.053/');
$this->dtdValidator = new DtdValidator(__DIR__.'/../../metadata/cxml/dtd/1.2.053/');
}

public function testMinimumExample(): void
Expand All @@ -53,14 +53,14 @@ public function testMinimumExample(): void
ItemIn::create(
3,
new ItemId('5555', null, 'KD5555'),
(ItemDetail::create(
ItemDetail::create(
Description::createWithShortName('Excelsior Desk Chair', null, 'en'),
'EA',
new MoneyWrapper('USD', 76320),
[
new Classification('UNSPSC', 'ean1234')
new Classification('UNSPSC', 'ean1234'),
]
))
)
)
)->addPunchoutOrderMessageItem(
ItemIn::create(
Expand All @@ -71,7 +71,7 @@ public function testMinimumExample(): void
'EA',
new MoneyWrapper('USD', 76320),
[
new Classification('UNSPSC', 'ean1234')
new Classification('UNSPSC', 'ean1234'),
]
)
)
Expand Down
9 changes: 5 additions & 4 deletions tests/CXmlTest/Model/SerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ public function testDeserializeWithDateTimeForDate(): void
<ItemOut quantity="1" requestedDeliveryDate="2023-02-25T02:30:00-08:00" lineNumber="1">
</ItemOut>
<ItemOut quantity="2" requestedDeliveryDate="2023-02-26" lineNumber="2">
</ItemOut>
</ItemOut>
<ItemOut quantity="3" lineNumber="3">
</ItemOut>
</ItemOut>
</OrderRequest>
</Request>
</cXML>';
Expand All @@ -277,7 +277,7 @@ public function testDeserializeWithDateTimeForDate(): void
$this->assertEquals('2023-02-26', $orderRequest->getItems()[1]->getRequestedDeliveryDate()->format('Y-m-d'));
$this->assertInstanceOf(Date::class, $orderRequest->getItems()[1]->getRequestedDeliveryDate());

$this->assertEquals(null, $orderRequest->getItems()[2]->getRequestedDeliveryDate());
$this->assertNull($orderRequest->getItems()[2]->getRequestedDeliveryDate());
}

public function testDeserializeInvalidDate(): void
Expand Down Expand Up @@ -320,7 +320,8 @@ public function testSerializeDateOnly(): void
$orderRequest =
OrderRequestBuilder::create('order-id', $orderDate, 'EUR')
->billTo('name')
->build();
->build()
;

$header = new Header(
$from,
Expand Down
2 changes: 1 addition & 1 deletion tests/CXmlTest/Validation/MessageValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MessageValidatorTest extends TestCase

protected function setUp(): void
{
$this->dtdValidator = new DtdValidator(__DIR__ . '/../../metadata/cxml/dtd/1.2.053');
$this->dtdValidator = new DtdValidator(__DIR__.'/../../metadata/cxml/dtd/1.2.053');
}

public function testValidateSuccess(): void
Expand Down

0 comments on commit fb6284d

Please sign in to comment.