Skip to content

Commit d161ece

Browse files
committed
fix: fix PHP 8.5 deprecations, add missing namespace in tests
Signed-off-by: Roman Ondráček <mail@romanondracek.cz>
1 parent 052cecf commit d161ece

9 files changed

Lines changed: 17 additions & 6 deletions

src/InfluxDB2/FluxCsvParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ private function toValue($strVal, FluxColumn $column)
283283
if ($strVal == '-Inf') {
284284
return -INF;
285285
}
286-
return (double)$strVal;
286+
return (float)$strVal;
287287
}
288288

289289
if ('base64Binary' == $column->dataType) {

tests/ClientTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Exception;
66
use InfluxDB2\Client;
7-
use IntegrationBaseTestCase;
87

98
require_once('IntegrationBaseTestCase.php');
109

tests/DefaultApiTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ private function property_value(object $object, string $property_name): object
156156
{
157157
$reflection = new ReflectionObject($object);
158158
$property = $reflection->getProperty($property_name);
159-
$property->setAccessible(true);
159+
if (PHP_VERSION_ID < 80100) {
160+
$property->setAccessible(true);
161+
}
160162
return $property->getValue($object);
161163
}
162164
}

tests/FluxCsvParserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ private function assertMultipleRecords(array $tables)
515515
private function assertRecord(FluxRecord $fluxRecord, array $values, $size = 0, $value = null)
516516
{
517517
foreach ($values as $key => $val) {
518-
$this->assertEquals($values[$key], $fluxRecord->values[$key]);
518+
$this->assertEquals($val, $fluxRecord->values[$key]);
519519
}
520520

521521
if ($value == null) {

tests/ITBucketServiceTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace InfluxDB2Test;
4+
35
use InfluxDB2\ApiException;
46
use InfluxDB2\Model\BucketRetentionRules;
57
use InfluxDB2\Model\PostBucketRequest;

tests/ITTaskServiceTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace InfluxDB2Test;
4+
35
use InfluxDB2\Model\TaskCreateRequest;
46
use InfluxDB2\Service\TasksService;
57

tests/ITUsersServiceTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace InfluxDB2Test;
4+
35
use InfluxDB2\Service\UsersService;
46

57
require_once('IntegrationBaseTestCase.php');

tests/IntegrationBaseTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace InfluxDB2Test;
4+
35
use InfluxDB2\Client;
46
use InfluxDB2\Model\Organization;
57
use InfluxDB2\Model\WritePrecision;

tests/WriteUdpTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ class WriteUdpTest extends TestCase
2626
protected function getWriterMock()
2727
{
2828
$method = new \ReflectionMethod(UdpWriter::class, 'writeSocket');
29-
$method->setAccessible(true);
29+
if (PHP_VERSION_ID < 80100) {
30+
$method->setAccessible(true);
31+
}
3032
return $this->getMockBuilder(UdpWriter::class)
31-
->setMethods(['writeSocket'])
33+
->onlyMethods(['writeSocket'])
3234
->setConstructorArgs([$this->baseConfig + ['udpPort' => 1000]])
3335
->getMock();
3436
}

0 commit comments

Comments
 (0)