Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Sep 26, 2024
1 parent 7ab4129 commit 20821bc
Show file tree
Hide file tree
Showing 142 changed files with 947 additions and 814 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"prefer-stable": true,
"require": {
"php": "^8.1",
"yiisoft/data": "dev-tests-reogranization",
"yiisoft/data": "dev-master",
"yiisoft/db": "^1.3"
},
"require-dev": {
Expand Down
20 changes: 19 additions & 1 deletion tests/Base/TestCase.php → tests/Base/DataTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Yiisoft\Db\Driver\Pdo\PdoConnectionInterface;
use Yiisoft\Db\Query\Query;

abstract class TestCase extends \PHPUnit\Framework\TestCase
trait DataTrait
{
use FixtureTrait;

Expand Down Expand Up @@ -45,6 +45,24 @@ protected function getReader(): DataReaderInterface
return new QueryDataReader((new Query($db))->from('user'));
}

protected function assertFixtures(array $expectedFixtureIndexes, array $actualFixtures): void
{
$processedActualFixtures = [];
foreach ($actualFixtures as $fixture) {
if (is_object($fixture)) {
$fixture = json_decode(json_encode($fixture), associative: true);
}

unset($fixture['id']);
$fixture['number'] = (int) $fixture['number'];
$fixture['balance'] = (float) $fixture['balance'];

$processedActualFixtures[$fixture['number'] - 1] = $fixture;
}

parent::assertFixtures($expectedFixtureIndexes, $processedActualFixtures);
}

protected function populateDatabase(): void
{
/** @var PdoConnectionInterface $db */
Expand Down
13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/AllHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/AnyHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/BetweenHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/EqualsHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/EqualsNullHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/GreaterThanHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/GreaterThanOrEqualHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/LessThanHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/LessThanOrEqualHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/LikeHandlerTest.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Base/FilterHandler/NotHandlerTest.php

This file was deleted.

3 changes: 3 additions & 0 deletions tests/Base/QueryDataReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use DateTime;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Yiisoft\Data\Db\QueryDataReader;
use Yiisoft\Data\Db\Tests\Support\CustomerDataReader;
use Yiisoft\Data\Db\Tests\Support\CustomerDTO;
Expand All @@ -28,6 +29,8 @@

abstract class QueryDataReaderTest extends TestCase
{
use DataTrait;

public function testDataReader(): void
{
$db = $this->getConnection();
Expand Down
12 changes: 12 additions & 0 deletions tests/Base/Reader/ReaderWithFilter/BaseReaderWithAllTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithAllTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithAllTestCase
{
use DataTrait;
}
12 changes: 12 additions & 0 deletions tests/Base/Reader/ReaderWithFilter/BaseReaderWithAnyTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithAnyTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithAnyTestCase
{
use DataTrait;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithBetweenTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithBetweenTestCase
{
use DataTrait;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithEqualsNullTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithEqualsNullTestCase
{
use DataTrait;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithEqualsTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithEqualsTestCase
{
use DataTrait;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithGreaterThanOrEqualTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithGreaterThanOrEqualTestCase
{
use DataTrait;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithGreaterThanTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithGreaterThanTestCase
{
use DataTrait;
}
12 changes: 12 additions & 0 deletions tests/Base/Reader/ReaderWithFilter/BaseReaderWithInTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithInTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithInTestCase
{
use DataTrait;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithLessThanOrEqualTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithLessThanOrEqualTestCase
{
use DataTrait;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithLessThanTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithLessThanTestCase
{
use DataTrait;
}
12 changes: 12 additions & 0 deletions tests/Base/Reader/ReaderWithFilter/BaseReaderWithLikeTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithLikeTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithLikeTestCase
{
use DataTrait;
}
12 changes: 12 additions & 0 deletions tests/Base/Reader/ReaderWithFilter/BaseReaderWithNotTestCase.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Tests\Base\Reader\ReaderWithFilter;

use Yiisoft\Data\Db\Tests\Base\DataTrait;

abstract class BaseReaderWithNotTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithNotTestCase
{
use DataTrait;
}
9 changes: 0 additions & 9 deletions tests/Base/ReaderTrait.php

This file was deleted.

12 changes: 0 additions & 12 deletions tests/Mssql/FilterHandler/AllHandlerTest.php

This file was deleted.

Loading

0 comments on commit 20821bc

Please sign in to comment.