Skip to content

Commit 00c4843

Browse files
committed
PHP 8.1 Implementation
1 parent 3415142 commit 00c4843

File tree

14 files changed

+33
-71
lines changed

14 files changed

+33
-71
lines changed

.github/workflows/phpunit.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@ jobs:
1616
strategy:
1717
matrix:
1818
php-version:
19+
- "8.3"
1920
- "8.2"
2021
- "8.1"
21-
- "8.0"
22-
- "7.4"
2322

2423
steps:
2524
- uses: actions/checkout@v4

.vscode/launch.json

Lines changed: 0 additions & 38 deletions
This file was deleted.

composer.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,17 @@
66
"ByJG\\AnyDataset\\Core\\": "src/"
77
}
88
},
9+
"autoload-dev": {
10+
"psr-4": {
11+
"Tests\\": "tests/"
12+
}
13+
},
914
"prefer-stable": true,
1015
"minimum-stability": "dev",
1116
"require": {
12-
"php": ">=7.4",
13-
"byjg/xmlutil": "4.9.*",
14-
"byjg/serializer": "4.9.*"
17+
"php": ">=8.1",
18+
"byjg/xmlutil": "^5.0",
19+
"byjg/serializer": "^5.0"
1520
},
1621
"suggest": {
1722
"ext-dom": "*"

src/Row.php

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

33
namespace ByJG\AnyDataset\Core;
44

5-
use ByJG\Serializer\SerializerObject;
5+
use ByJG\Serializer\Serialize;
66

77
class Row
88
{
@@ -33,7 +33,7 @@ public function __construct($instance = [])
3333
if (is_array($instance)) {
3434
$this->row = $instance;
3535
} else {
36-
$this->row = SerializerObject::instance($instance)->serialize();
36+
$this->row = Serialize::from($instance)->toArray();
3737
}
3838

3939
$this->acceptChanges();

tests/AnyDatasetTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Tests\AnyDataset\Dataset;
3+
namespace Tests;
44

55
use ByJG\AnyDataset\Core\AnyDataset;
66
use ByJG\AnyDataset\Core\Enum\Relation;

tests/IteratorFilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Tests\AnyDataset\Dataset;
3+
namespace Tests;
44

55
use ByJG\AnyDataset\Core\IteratorFilter;
66
use ByJG\AnyDataset\Core\IteratorFilterXPathFormatter;

tests/ModelTest.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<?php
22

3-
namespace Tests\AnyDataset\Dataset;
3+
namespace Tests;
44

55
use ByJG\AnyDataset\Core\AnyDataset;
6-
use ByJG\Serializer\SerializerObject;
6+
use ByJG\Serializer\Serialize;
77
use PHPUnit\Framework\TestCase;
8-
9-
require_once "Sample/SampleModel.php";
8+
use Tests\Sample\SampleModel;
109

1110
class ModelTest extends TestCase
1211
{
@@ -16,7 +15,7 @@ public function testBindSingleRow()
1615
$sr->addField("id", 10);
1716
$sr->addField("name", "Testing");
1817

19-
$object = new \Tests\AnyDataset\Sample\SampleModel($sr->toArray());
18+
$object = new SampleModel($sr->toArray());
2019

2120
$this->assertEquals(10, $object->Id);
2221
$this->assertEquals("Testing", $object->getName());
@@ -31,7 +30,7 @@ public function testBindIterator()
3130
$sr->addField("name", "Testing");
3231
$anydata->appendRow($sr);
3332

34-
$object = new \Tests\AnyDataset\Sample\SampleModel($anydata->getIterator()->moveNext()->toArray());
33+
$object = new SampleModel($anydata->getIterator()->moveNext()->toArray());
3534

3635
$this->assertEquals(10, $object->Id);
3736
$this->assertEquals("Testing", $object->getName());
@@ -46,8 +45,8 @@ public function testBind_Iterator2()
4645
$anydata->addField('Id', 20);
4746
$anydata->addField('Name', 'Gilberto');
4847

49-
$object1 = new \Tests\AnyDataset\Sample\SampleModel();
50-
$object1->bindFrom( $anydata->getIterator()->moveNext()->toArray() );
48+
$object1 = new SampleModel();
49+
$object1->copyFrom( $anydata->getIterator()->moveNext()->toArray() );
5150
$this->assertEquals(10, $object1->Id);
5251
$this->assertEquals('Joao', $object1->getName());
5352
}
@@ -64,8 +63,8 @@ public function testIterator()
6463

6564
$iterator = $model->getIterator();
6665

67-
$object = new SerializerObject($iterator->toArray());
68-
$result = $object->serialize();
66+
$object = Serialize::from($iterator->toArray());
67+
$result = $object->toArray();
6968

7069
$this->assertEquals(
7170
[

tests/RowOutputTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Tests\AnyDataset\Dataset;
3+
namespace Tests;
44

55
use ByJG\AnyDataset\Core\Row;
66
use ByJG\AnyDataset\Core\RowValidator;

tests/RowTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
<?php
22

3-
namespace Tests\AnyDataset\Dataset;
3+
namespace Tests;
44

55
use ByJG\AnyDataset\Core\Formatter\JsonFormatter;
66
use ByJG\AnyDataset\Core\Formatter\XmlFormatter;
77
use ByJG\AnyDataset\Core\Row;
88
use PHPUnit\Framework\TestCase;
9-
use Tests\AnyDataset\Sample\ModelGetter;
10-
use Tests\AnyDataset\Sample\ModelPublic;
119
use ByJG\Util\XmlUtil;
1210
use stdClass;
13-
14-
require_once "Sample/ModelPublic.php";
15-
require_once "Sample/ModelGetter.php";
16-
require_once "Sample/ModelPropertyPattern.php";
11+
use Tests\Sample\ModelGetter;
12+
use Tests\Sample\ModelPropertyPattern;
13+
use Tests\Sample\ModelPublic;
1714

1815
class RowTest extends TestCase
1916
{
@@ -302,7 +299,7 @@ public function testConstructor_Array()
302299

303300
public function testConstructor_PropertyPattern()
304301
{
305-
$model = new \Tests\AnyDataset\Sample\ModelPropertyPattern();
302+
$model = new ModelPropertyPattern();
306303
$model->setIdModel(10);
307304
$model->setClientName("Testing");
308305

tests/RowValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Tests\AnyDataset\Dataset;
3+
namespace Tests;
44

55
use ByJG\AnyDataset\Core\Row;
66
use ByJG\AnyDataset\Core\RowValidator;

0 commit comments

Comments
 (0)