Skip to content

Commit

Permalink
added if-else for failing tests (PHP 8.0 vs 8.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
k00ni committed Feb 29, 2024
1 parent 5f3d2e4 commit 2722b4f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: push

jobs:
linux-tests:
name: Linux-Tests with PHP ${{ matrix.php-versions }}
name: Linux-Tests with PHP ${{ matrix.php }}
runs-on: ubuntu-latest

env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,15 +497,26 @@ public function testAggSum01()

$result = $this->store->query($query);

$this->assertEquals(
[
// PHP works differently prior to 8.1.0 therefore the if-else here
if (version_compare(PHP_VERSION, '8.1.0', '<')) {
$this->assertEquals(
[
// ,---- seems to be too precise
'sum' => 11.100000000000001, 'sum type' => 'literal',
[
'sum' => 11.1, 'sum type' => 'literal',
],
],
],
$result['result']['rows']
);
$result['result']['rows']
);
} else {
$this->assertEquals(
[
[
'sum' => 11.100000000000001, 'sum type' => 'literal',
],
],
$result['result']['rows']
);
}
}

public function testAggSum02()
Expand Down Expand Up @@ -566,14 +577,23 @@ public function testAggSum02()
$result['result']['rows'][3]
);

$this->assertEquals(
[
's' => 'http://www.example.org/mixed2', 's type' => 'uri',
// ,--- seems to be a rounding problem
'sum' => 2.4000000000000004, 'sum type' => 'literal',
],
$result['result']['rows'][4]
);

// PHP works differently prior to 8.1.0 therefore the if-else here
if (version_compare(PHP_VERSION, '8.1.0', '<')) {
$this->assertEquals(
[
's' => 'http://www.example.org/mixed2', 's type' => 'uri',
'sum' => 2.4, 'sum type' => 'literal',
],
$result['result']['rows'][4]
);
} else {
$this->assertEquals(
[
's' => 'http://www.example.org/mixed2', 's type' => 'uri',
'sum' => 2.4000000000000004, 'sum type' => 'literal',
],
$result['result']['rows'][4]
);
}
}
}

0 comments on commit 2722b4f

Please sign in to comment.