Skip to content

Commit

Permalink
Update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
willemverspyck committed Feb 22, 2023
1 parent 5127085 commit 1d0e74b
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 45 deletions.
13 changes: 6 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,21 @@
"snowflake",
"sdk",
"database",
"service",
"php",
"api"
],
"homepage": "https://github.com/willemverspyck/snowflake-sdk-php",
"type": "library",
"require": {
"php": "^8.1",
"web-token/jwt-core": "^2|^3",
"web-token/jwt-key-mgmt": "^2|^3",
"web-token/jwt-signature": "^2|^3",
"web-token/jwt-signature-algorithm-rsa": "^2|^3",
"symfony/http-client": "^5.3|^6.0"
"web-token/jwt-core": "^3",
"web-token/jwt-key-mgmt": "^3",
"web-token/jwt-signature": "^3",
"web-token/jwt-signature-algorithm-rsa": "^3",
"symfony/http-client": "^6.0"
},
"require-dev": {
"phpunit/phpunit": "^9",
"phpunit/phpunit": "^10",
"squizlabs/php_codesniffer": "^3"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage>
<include>
<directory>./src</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Translate.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private function getTimeWithTimezone(?string $value): ?DateTimeInterface
}

if (1 === preg_match('/^(\d+\.\d{6})\d{3}\s(\d{1,4})/is', $value, $matches)) {
$timezone = new DateTimeZone(sprintf('+%02d:%02d', floor($matches[2] / 60), $matches[2] % 2));
$timezone = new DateTimeZone(sprintf('+%02d:%02d', floor($matches[2] / 60), $matches[2] % 60));

$date = new DateTime(sprintf('@%f', $matches[1]));
$date->setTimezone($timezone);
Expand Down
8 changes: 4 additions & 4 deletions tests/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testGetUser(): void
{
$this->client->setUser('USER');

self::assertEquals('USER', $this->client->getUser());
self::assertSame('USER', $this->client->getUser());
}

public function testGetAccountException(): void
Expand All @@ -42,7 +42,7 @@ public function testGetAccount(): void
{
$this->client->setAccount('ACCOUNT');

self::assertEquals('ACCOUNT', $this->client->getAccount());
self::assertSame('ACCOUNT', $this->client->getAccount());
}

public function testGetPublicKeyException(): void
Expand All @@ -56,7 +56,7 @@ public function testGetPublicKey(): void
{
$this->client->setPublicKey('PUBLIC_KEY');

self::assertEquals('PUBLIC_KEY', $this->client->getPublicKey());
self::assertSame('PUBLIC_KEY', $this->client->getPublicKey());
}

public function testGetPrivateKeyException(): void
Expand All @@ -70,6 +70,6 @@ public function testGetPrivateKey(): void
{
$this->client->setPrivateKey('PRIVATE_KEY');

self::assertEquals('PRIVATE_KEY', $this->client->getPrivateKey());
self::assertSame('PRIVATE_KEY', $this->client->getPrivateKey());
}
}
16 changes: 8 additions & 8 deletions tests/ResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function setUp(): void

public function testGetId(): void
{
self::assertEquals('ID', $this->result->getId());
self::assertSame('ID', $this->result->getId());
}

public function testGetTotal(): void
Expand All @@ -37,7 +37,7 @@ public function testGetTotal(): void

$this->result->setTotal(10);

self::assertEquals(10, $this->result->getTotal());
self::assertSame(10, $this->result->getTotal());
}

public function testGetPage(): void
Expand All @@ -46,7 +46,7 @@ public function testGetPage(): void

$this->result->setPage(1);

self::assertEquals(1, $this->result->getPage());
self::assertSame(1, $this->result->getPage());
}

public function testGetPageTotal(): void
Expand All @@ -55,7 +55,7 @@ public function testGetPageTotal(): void

$this->result->setPageTotal(20);

self::assertEquals(20, $this->result->getPageTotal());
self::assertSame(20, $this->result->getPageTotal());
}

public function testGetFields(): void
Expand All @@ -68,7 +68,7 @@ public function testGetFields(): void
],
]);

self::assertEquals([
self::assertSame([
[
'name' => 'Field1',
],
Expand Down Expand Up @@ -103,7 +103,7 @@ public function testGetData(): void
],
]);

self::assertEquals([
self::assertSame([
[
'FIELD1' => 'value1',
'FIELD2' => true,
Expand All @@ -130,7 +130,7 @@ public function testGetDataRaw(): void
],
]);

self::assertEquals([
self::assertSame([
[
'field1',
'field2',
Expand All @@ -149,7 +149,7 @@ public function testGetTimestamp(): void
$this->result->setTimestamp(1633082116654);

self::assertInstanceOf(DateTimeInterface::class, $this->result->getTimestamp());
self::assertEquals(new DateTime('2021-10-01T09:55:16.0000000+00:00'), $this->result->getTimestamp());
self::assertSame('2021-10-01T11:55:16.000000+02:00', $this->result->getTimestamp()->format('Y-m-d\TH:i:s.uP'));
}

public function testIsExecuted(): void
Expand Down
8 changes: 4 additions & 4 deletions tests/ServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testGetWarehouse(): void

$this->service->setWarehouse('ACCOUNT');

self::assertEquals('ACCOUNT', $this->service->getWarehouse());
self::assertSame('ACCOUNT', $this->service->getWarehouse());
}

public function testGetDatabase(): void
Expand All @@ -36,7 +36,7 @@ public function testGetDatabase(): void

$this->service->setDatabase('DATABASE');

self::assertEquals('DATABASE', $this->service->getDatabase());
self::assertSame('DATABASE', $this->service->getDatabase());
}

public function testGetSchema(): void
Expand All @@ -45,7 +45,7 @@ public function testGetSchema(): void

$this->service->setSchema('SCHEMA');

self::assertEquals('SCHEMA', $this->service->getSchema());
self::assertSame('SCHEMA', $this->service->getSchema());
}

public function testGetRole(): void
Expand All @@ -54,7 +54,7 @@ public function testGetRole(): void

$this->service->setRole('ROLE');

self::assertEquals('ROLE', $this->service->getRole());
self::assertSame('ROLE', $this->service->getRole());
}

public function testIsNullable(): void
Expand Down
40 changes: 20 additions & 20 deletions tests/TranslateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function testGetFields(): void

$this->translate->setFields($fields);

self::assertEquals($fields, $this->translate->getFields());
self::assertSame($fields, $this->translate->getFields());
}

public function testSetFields(): void
Expand Down Expand Up @@ -63,9 +63,9 @@ public function testGetDate(): void

$method = $reflection->getMethod('getDate');

self::assertEquals(new DateTime('1970-01-01'), $method->invokeArgs($this->translate, ['0']));
self::assertEquals(new DateTime('1970-01-02'), $method->invokeArgs($this->translate, ['1']));
self::assertEquals(new DateTime('2019-04-14'), $method->invokeArgs($this->translate, ['18000']));
self::assertSame('1970-01-01', $method->invokeArgs($this->translate, ['0'])->format('Y-m-d'));
self::assertSame('1970-01-02', $method->invokeArgs($this->translate, ['1'])->format('Y-m-d'));
self::assertSame('2019-04-14', $method->invokeArgs($this->translate, ['18000'])->format('Y-m-d'));

self::assertNull($method->invokeArgs($this->translate, [null]));
}
Expand All @@ -76,16 +76,16 @@ public function testGetFixed(): void

$method = $reflection->getMethod('getFixed');

self::assertEquals(12345, $method->invokeArgs($this->translate, ['12345', 0]));
self::assertSame(12345, $method->invokeArgs($this->translate, ['12345', 0]));
self::assertIsInt($method->invokeArgs($this->translate, ['12345', 0]));

self::assertEquals(12345, $method->invokeArgs($this->translate, ['12345.1234567890', 0]));
self::assertSame(12345, $method->invokeArgs($this->translate, ['12345.1234567890', 0]));
self::assertIsInt($method->invokeArgs($this->translate, ['12345.1234567890', 0]));

self::assertEquals(12345.0, $method->invokeArgs($this->translate, ['12345', 6]));
self::assertSame(12345.0, $method->invokeArgs($this->translate, ['12345', 6]));
self::assertIsFloat($method->invokeArgs($this->translate, ['12345', 6]));

self::assertEquals(12345.123456789, $method->invokeArgs($this->translate, ['12345.1234567890', 6]));
self::assertSame(12345.123456789, $method->invokeArgs($this->translate, ['12345.1234567890', 6]));
self::assertIsFloat($method->invokeArgs($this->translate, ['12345.1234567890', 6]));

self::assertNull($method->invokeArgs($this->translate, [null, 0]));
Expand All @@ -97,8 +97,8 @@ public function testGetTime(): void

$method = $reflection->getMethod('getTime');

self::assertEquals(new DateTime('2021-03-19T17:06:59+00:00'), $method->invokeArgs($this->translate, ['1616173619.000000000']));
self::assertEquals(new DateTime('2021-03-19T17:06:59.123456+00:00'), $method->invokeArgs($this->translate, ['1616173619.123456789']));
self::assertSame('2021-03-19T17:06:59.000000+00:00', $method->invokeArgs($this->translate, ['1616173619.000000000'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-19T17:06:59.123456+00:00', $method->invokeArgs($this->translate, ['1616173619.123456789'])->format('Y-m-d\TH:i:s.uP'));

self::assertNull($method->invokeArgs($this->translate, ['1616173619000000000']));
self::assertNull($method->invokeArgs($this->translate, [null]));
Expand All @@ -110,16 +110,16 @@ public function testGetTimeWithTimezone(): void

$method = $reflection->getMethod('getTimeWithTimezone');

self::assertEquals(new DateTime('2021-03-19T17:06:59+00:00'), $method->invokeArgs($this->translate, ['1616173619.000000000 0']));
self::assertEquals(new DateTime('2021-03-19T17:36:59+00:30'), $method->invokeArgs($this->translate, ['1616173619.000000000 30']));
self::assertEquals(new DateTime('2021-03-19T18:06:59+01:00'), $method->invokeArgs($this->translate, ['1616173619.000000000 60']));
self::assertEquals(new DateTime('2021-03-20T09:06:59+16:00'), $method->invokeArgs($this->translate, ['1616173619.000000000 960']));
self::assertEquals(new DateTime('2021-03-20T09:36:59+16:30'), $method->invokeArgs($this->translate, ['1616173619.000000000 990']));
self::assertEquals(new DateTime('2021-03-19T17:06:59.123456+00:00'), $method->invokeArgs($this->translate, ['1616173619.123456789 0']));
self::assertEquals(new DateTime('2021-03-19T17:36:59.123456+00:30'), $method->invokeArgs($this->translate, ['1616173619.123456789 30']));
self::assertEquals(new DateTime('2021-03-19T18:06:59.123456+01:00'), $method->invokeArgs($this->translate, ['1616173619.123456789 60']));
self::assertEquals(new DateTime('2021-03-20T09:06:59.123456+16:00'), $method->invokeArgs($this->translate, ['1616173619.123456789 960']));
self::assertEquals(new DateTime('2021-03-20T09:36:59.123456+16:30'), $method->invokeArgs($this->translate, ['1616173619.123456789 990']));
self::assertSame('2021-03-19T17:06:59.000000+00:00', $method->invokeArgs($this->translate, ['1616173619.000000000 0'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-19T17:36:59.000000+00:30', $method->invokeArgs($this->translate, ['1616173619.000000000 30'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-19T18:06:59.000000+01:00', $method->invokeArgs($this->translate, ['1616173619.000000000 60'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-20T09:06:59.000000+16:00', $method->invokeArgs($this->translate, ['1616173619.000000000 960'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-20T09:36:59.000000+16:30', $method->invokeArgs($this->translate, ['1616173619.000000000 990'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-19T17:06:59.123456+00:00', $method->invokeArgs($this->translate, ['1616173619.123456789 0'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-19T17:36:59.123456+00:30', $method->invokeArgs($this->translate, ['1616173619.123456789 30'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-19T18:06:59.123456+01:00', $method->invokeArgs($this->translate, ['1616173619.123456789 60'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-20T09:06:59.123456+16:00', $method->invokeArgs($this->translate, ['1616173619.123456789 960'])->format('Y-m-d\TH:i:s.uP'));
self::assertSame('2021-03-20T09:36:59.123456+16:30', $method->invokeArgs($this->translate, ['1616173619.123456789 990'])->format('Y-m-d\TH:i:s.uP'));

self::assertNull($method->invokeArgs($this->translate, ['1616173619.000000000']));
self::assertNull($method->invokeArgs($this->translate, ['1616173619.123456789']));
Expand Down

0 comments on commit 1d0e74b

Please sign in to comment.