Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
arogachev committed Oct 14, 2024
1 parent 5f86ea7 commit 756eb0f
Show file tree
Hide file tree
Showing 19 changed files with 242 additions and 31 deletions.
20 changes: 20 additions & 0 deletions src/Exception/NotSupportedFilterOptionException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\Exception;

use InvalidArgumentException;
use Throwable;

final class NotSupportedFilterOptionException extends InvalidArgumentException
{
/**
* @param string $optionName Option name in filter.
* @param string $driverName Driver name of database.
*/
public function __construct(string $optionName, string $driverName, int $code = 0, ?Throwable $previous = null)
{
parent::__construct("\$$optionName option is not supported when using $driverName driver.", $code, $previous);
}
}
4 changes: 2 additions & 2 deletions src/FilterHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use Yiisoft\Data\Db\FilterHandler\InFilterHandler;
use Yiisoft\Data\Db\FilterHandler\LessThanFilterHandler;
use Yiisoft\Data\Db\FilterHandler\LessThanOrEqualFilterHandler;
use Yiisoft\Data\Db\FilterHandler\LikeFilterHandler;
use Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\LikeFilterHandlerFactory;
use Yiisoft\Data\Db\FilterHandler\NotFilterHandler;
use Yiisoft\Data\Db\FilterHandler\QueryFilterHandlerInterface;
use Yiisoft\Data\Reader\FilterHandlerInterface;
Expand Down Expand Up @@ -55,7 +55,7 @@ public function __construct(
new GreaterThanOrEqualFilterHandler(),
new LessThanFilterHandler(),
new LessThanOrEqualFilterHandler(),
new LikeFilterHandler(),
LikeFilterHandlerFactory::getLikeHandler(),

Check failure on line 58 in src/FilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

TooFewArguments

src/FilterHandler.php:58:17: TooFewArguments: Too few arguments for Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\LikeFilterHandlerFactory::getLikeHandler - expecting driverName to be passed (see https://psalm.dev/025)

Check failure on line 58 in src/FilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

TooFewArguments

src/FilterHandler.php:58:17: TooFewArguments: Too few arguments for Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\LikeFilterHandlerFactory::getLikeHandler - expecting driverName to be passed (see https://psalm.dev/025)

Check failure on line 58 in src/FilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.3-ubuntu-latest

TooFewArguments

src/FilterHandler.php:58:17: TooFewArguments: Too few arguments for Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\LikeFilterHandlerFactory::getLikeHandler - expecting driverName to be passed (see https://psalm.dev/025)
new InFilterHandler(),
new ExistsFilterHandler(),
new NotFilterHandler(),
Expand Down
23 changes: 0 additions & 23 deletions src/FilterHandler/LikeFilterHandler.php

This file was deleted.

27 changes: 27 additions & 0 deletions src/FilterHandler/LikeFilterHandler/BaseLikeFilterHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\FilterHandler\LikeFilterHandler;

use Yiisoft\Data\Reader\Filter\Like;
use Yiisoft\Data\Reader\FilterHandlerInterface;

abstract class BaseLikeFilterHandler implements FilterHandlerInterface
{
protected array $escapingReplacements = [
'%' => '\%',
'_' => '\_',
'\\' => '\\\\',
];

public function getFilterClass(): string
{
return Like::class;
}

protected function prepareValue(string $value, bool $escape = false): string
{
return '%' . strtr($value, $this->escapingReplacements) . '%';
}
}
26 changes: 26 additions & 0 deletions src/FilterHandler/LikeFilterHandler/LikeFilterHandlerFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\FilterHandler\LikeFilterHandler;

use RuntimeException;
use Yiisoft\Data\Reader\FilterHandlerInterface;

class LikeFilterHandlerFactory
{
public static function getLikeHandler(string $driverName): FilterHandlerInterface
{
// default - ignored due to the complexity of testing and preventing splitting of databaseDriver argument.
// @codeCoverageIgnoreStart
return match ($driverName) {
'sqlite' => new SqliteLikeFilterHandler(),
'mysql' => new MysqlLikeFilterHandler(),
'pgsql' => new PostgresLikeFilterHandler(),
'sqlsrv' => new MssqlLikeFilterHandler(),
'oci' => new OracleLikeFilterHandler(),
default => throw new RuntimeException("$driverName database driver is not supported."),
};
// @codeCoverageIgnoreEnd
}
}
28 changes: 28 additions & 0 deletions src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\FilterHandler\LikeFilterHandler;

use Yiisoft\Data\Db\Exception\NotSupportedFilterOptionException;
use Yiisoft\Data\Db\FilterHandler\Context;
use Yiisoft\Data\Db\FilterHandler\Criteria;
use Yiisoft\Data\Db\FilterHandler\QueryFilterHandlerInterface;
use Yiisoft\Data\Reader\FilterInterface;

final class MssqlLikeFilterHandler extends BaseLikeFilterHandler implements QueryFilterHandlerInterface
{
public function __construct()
{
unset($this->escapingReplacements['\\']);
}

public function getCriteria(FilterInterface $filter, Context $context): ?Criteria
{
if ($filter->isCaseSensitive() === true) {

Check failure on line 22 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:22:22: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::isCaseSensitive does not exist (see https://psalm.dev/181)

Check failure on line 22 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:22:22: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::isCaseSensitive does not exist (see https://psalm.dev/181)

Check failure on line 22 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.3-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:22:22: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::isCaseSensitive does not exist (see https://psalm.dev/181)
throw new NotSupportedFilterOptionException(optionName: 'caseSensitive', driverName: 'sqlsrv');
}

return new Criteria(['LIKE', $filter->getField(), $this->prepareValue($filter->getValue())]);

Check failure on line 26 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:26:47: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getField does not exist (see https://psalm.dev/181)

Check failure on line 26 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

MixedArgument

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:26:79: MixedArgument: Argument 1 of Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\MssqlLikeFilterHandler::prepareValue cannot be mixed, expecting string (see https://psalm.dev/030)

Check failure on line 26 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:26:88: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getValue does not exist (see https://psalm.dev/181)

Check failure on line 26 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:26:47: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getField does not exist (see https://psalm.dev/181)

Check failure on line 26 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

MixedArgument

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:26:79: MixedArgument: Argument 1 of Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\MssqlLikeFilterHandler::prepareValue cannot be mixed, expecting string (see https://psalm.dev/030)

Check failure on line 26 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:26:88: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getValue does not exist (see https://psalm.dev/181)

Check failure on line 26 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.3-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:26:47: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getField does not exist (see https://psalm.dev/181)

Check failure on line 26 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.3-ubuntu-latest

MixedArgument

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:26:79: MixedArgument: Argument 1 of Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\MssqlLikeFilterHandler::prepareValue cannot be mixed, expecting string (see https://psalm.dev/030)

Check failure on line 26 in src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.3-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/MssqlLikeFilterHandler.php:26:88: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getValue does not exist (see https://psalm.dev/181)
}
}
29 changes: 29 additions & 0 deletions src/FilterHandler/LikeFilterHandler/MysqlLikeFilterHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\FilterHandler\LikeFilterHandler;

use Yiisoft\Data\Db\FilterHandler\Context;
use Yiisoft\Data\Db\FilterHandler\Criteria;
use Yiisoft\Data\Db\FilterHandler\QueryFilterHandlerInterface;
use Yiisoft\Data\Reader\Filter\Like;
use Yiisoft\Data\Reader\FilterInterface;

final class MysqlLikeFilterHandler extends BaseLikeFilterHandler implements QueryFilterHandlerInterface
{
public function getCriteria(FilterInterface $filter, Context $context): ?Criteria
{
/** @var Like $filter */

if ($filter->isCaseSensitive() !== true) {
return new Criteria(['LIKE', $filter->getField(), $this->prepareValue($filter->getValue())]);
}

return new Criteria([
'LIKE BINARY',
$filter->getField(),
$this->prepareValue($filter->getValue(), escape: true),
]);
}
}
18 changes: 18 additions & 0 deletions src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\FilterHandler\LikeFilterHandler;

use Yiisoft\Data\Db\FilterHandler\Context;
use Yiisoft\Data\Db\FilterHandler\Criteria;
use Yiisoft\Data\Db\FilterHandler\QueryFilterHandlerInterface;
use Yiisoft\Data\Reader\FilterInterface;

final class OracleLikeFilterHandler extends BaseLikeFilterHandler implements QueryFilterHandlerInterface
{
public function getCriteria(FilterInterface $filter, Context $context): ?Criteria
{
return new Criteria(['LIKE', $filter->getField(), $this->prepareValue($filter->getValue())]);

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php:16:47: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getField does not exist (see https://psalm.dev/181)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

MixedArgument

src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php:16:79: MixedArgument: Argument 1 of Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\OracleLikeFilterHandler::prepareValue cannot be mixed, expecting string (see https://psalm.dev/030)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php:16:88: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getValue does not exist (see https://psalm.dev/181)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php:16:47: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getField does not exist (see https://psalm.dev/181)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

MixedArgument

src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php:16:79: MixedArgument: Argument 1 of Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\OracleLikeFilterHandler::prepareValue cannot be mixed, expecting string (see https://psalm.dev/030)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php:16:88: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getValue does not exist (see https://psalm.dev/181)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.3-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php:16:47: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getField does not exist (see https://psalm.dev/181)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.3-ubuntu-latest

MixedArgument

src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php:16:79: MixedArgument: Argument 1 of Yiisoft\Data\Db\FilterHandler\LikeFilterHandler\OracleLikeFilterHandler::prepareValue cannot be mixed, expecting string (see https://psalm.dev/030)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.3-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/OracleLikeFilterHandler.php:16:88: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::getValue does not exist (see https://psalm.dev/181)
}
}
22 changes: 22 additions & 0 deletions src/FilterHandler/LikeFilterHandler/PostgresLikeFilterHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\FilterHandler\LikeFilterHandler;

use Yiisoft\Data\Db\FilterHandler\Context;
use Yiisoft\Data\Db\FilterHandler\Criteria;
use Yiisoft\Data\Db\FilterHandler\QueryFilterHandlerInterface;
use Yiisoft\Data\Reader\FilterInterface;

final class PostgresLikeFilterHandler extends BaseLikeFilterHandler implements QueryFilterHandlerInterface
{
public function getCriteria(FilterInterface $filter, Context $context): ?Criteria
{
if ($filter->isCaseSensitive() !== true) {

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/PostgresLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.2-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/PostgresLikeFilterHandler.php:16:22: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::isCaseSensitive does not exist (see https://psalm.dev/181)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/PostgresLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.1-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/PostgresLikeFilterHandler.php:16:22: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::isCaseSensitive does not exist (see https://psalm.dev/181)

Check failure on line 16 in src/FilterHandler/LikeFilterHandler/PostgresLikeFilterHandler.php

View workflow job for this annotation

GitHub Actions / psalm / PHP 8.3-ubuntu-latest

UndefinedInterfaceMethod

src/FilterHandler/LikeFilterHandler/PostgresLikeFilterHandler.php:16:22: UndefinedInterfaceMethod: Method Yiisoft\Data\Reader\FilterInterface::isCaseSensitive does not exist (see https://psalm.dev/181)
return new Criteria(['ILIKE', $filter->getField(), $this->prepareValue($filter->getValue(), escape: true)]);
}

return new Criteria(['LIKE', $filter->getField(), $this->prepareValue($filter->getValue())]);
}
}
28 changes: 28 additions & 0 deletions src/FilterHandler/LikeFilterHandler/SqliteLikeFilterHandler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

declare(strict_types=1);

namespace Yiisoft\Data\Db\FilterHandler\LikeFilterHandler;

use Yiisoft\Data\Db\Exception\NotSupportedFilterOptionException;
use Yiisoft\Data\Db\FilterHandler\Context;
use Yiisoft\Data\Db\FilterHandler\Criteria;
use Yiisoft\Data\Db\FilterHandler\QueryFilterHandlerInterface;
use Yiisoft\Data\Reader\FilterInterface;

final class SqliteLikeFilterHandler extends BaseLikeFilterHandler implements QueryFilterHandlerInterface
{
public function __construct()
{
unset($this->escapingReplacements['\\']);
}

public function getCriteria(FilterInterface $filter, Context $context): ?Criteria
{
if ($filter->isCaseSensitive() === true) {
throw new NotSupportedFilterOptionException(optionName: 'caseSensitive', driverName: 'sqlite');
}

return new Criteria(['LIKE', $filter->getField(), $this->prepareValue($filter->getValue())]);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
use Yiisoft\Db\Expression\Expression;
use Yiisoft\Db\Query\Query;

abstract class QueryDataReaderTest extends TestCase
abstract class BaseQueryDataReaderTestCase extends TestCase
{
use DataTrait;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@
abstract class BaseReaderWithLikeTestCase extends \Yiisoft\Data\Tests\Common\Reader\ReaderWithFilter\BaseReaderWithLikeTestCase
{
use DataTrait;

public static function dataWithReader(): array
{
$data = parent::dataWithReader();
$data['search: contains, different case, case sensitive: null'] = ['email', 'SEED@', null, [2]];

return $data;
}
}
4 changes: 3 additions & 1 deletion tests/Mssql/QueryDataReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace Yiisoft\Data\Db\Tests\Mssql;

final class QueryDataReaderTest extends \Yiisoft\Data\Db\Tests\Base\QueryDataReaderTest
use Yiisoft\Data\Db\Tests\Base\BaseQueryDataReaderTestCase;

final class QueryDataReaderTest extends BaseQueryDataReaderTestCase
{
use DatabaseTrait;

Expand Down
4 changes: 3 additions & 1 deletion tests/Mysql/QueryDataReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace Yiisoft\Data\Db\Tests\Mysql;

final class QueryDataReaderTest extends \Yiisoft\Data\Db\Tests\Base\QueryDataReaderTest
use Yiisoft\Data\Db\Tests\Base\BaseQueryDataReaderTestCase;

final class QueryDataReaderTest extends BaseQueryDataReaderTestCase
{
use DatabaseTrait;

Expand Down
9 changes: 9 additions & 0 deletions tests/Mysql/ReaderWithFilter/ReaderWithLikeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@
final class ReaderWithLikeTest extends BaseReaderWithLikeTestCase
{
use DatabaseTrait;

public static function dataWithReader(): array
{
$data = parent::dataWithReader();
$data['search: contains, same case, case sensitive: true'] = ['email', 'ed@be', true, [2]];
$data['search: contains, different case, case sensitive: true'] = ['email', 'SEED@', true, []];

return $data;
}
}
4 changes: 3 additions & 1 deletion tests/Oracle/QueryDataReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace Yiisoft\Data\Db\Tests\Oracle;

final class QueryDataReaderTest extends \Yiisoft\Data\Db\Tests\Base\QueryDataReaderTest
use Yiisoft\Data\Db\Tests\Base\BaseQueryDataReaderTestCase;

final class QueryDataReaderTest extends BaseQueryDataReaderTestCase
{
use DatabaseTrait;

Expand Down
4 changes: 3 additions & 1 deletion tests/Pgsql/QueryDataReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace Yiisoft\Data\Db\Tests\Pgsql;

final class QueryDataReaderTest extends \Yiisoft\Data\Db\Tests\Base\QueryDataReaderTest
use Yiisoft\Data\Db\Tests\Base\BaseQueryDataReaderTestCase;

final class QueryDataReaderTest extends BaseQueryDataReaderTestCase
{
use DatabaseTrait;

Expand Down
9 changes: 9 additions & 0 deletions tests/Pgsql/ReaderWithFilter/ReaderWithLikeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@
final class ReaderWithLikeTest extends BaseReaderWithLikeTestCase
{
use DatabaseTrait;

public static function dataWithReader(): array
{
$data = parent::dataWithReader();
$data['search: contains, same case, case sensitive: true'] = ['email', 'ed@be', true, [2]];
$data['search: contains, different case, case sensitive: true'] = ['email', 'SEED@', true, []];

return $data;
}
}
4 changes: 3 additions & 1 deletion tests/Sqlite/QueryDataReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace Yiisoft\Data\Db\Tests\Sqlite;

final class QueryDataReaderTest extends \Yiisoft\Data\Db\Tests\Base\QueryDataReaderTest
use Yiisoft\Data\Db\Tests\Base\BaseQueryDataReaderTestCase;

final class QueryDataReaderTest extends BaseQueryDataReaderTestCase
{
use DatabaseTrait;

Expand Down

0 comments on commit 756eb0f

Please sign in to comment.