Skip to content

Commit

Permalink
temporary disable amphp/postgres tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mmasiukevich committed Dec 4, 2021
1 parent 92bdf6e commit 731180b
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 26 deletions.
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -59,7 +59,7 @@
"boesing/psalm-plugin-stringf": "v1.1.*"
},
"prefer-stable": true,
"minimum-stability": "stable",
"minimum-stability": "dev",
"scripts": {
"psalm": "rm -rf ~/.cache/psalm/ && ./vendor/bin/psalm --config=psalm.xml",
"phpstan": "./vendor/bin/phpstan analyse src --level 9",
Expand Down
5 changes: 5 additions & 0 deletions phpunit.xml
Expand Up @@ -39,4 +39,9 @@
<directory>./tests/</directory>
</testsuite>
</testsuites>
<groups>
<exclude>
<group>amphp</group>
</exclude>
</groups>
</phpunit>
2 changes: 1 addition & 1 deletion src/Sql/Finder/CachedSqlFinder.php
Expand Up @@ -102,7 +102,7 @@ function () use ($criteria): \Generator
);
}

public function find(array $criteria, ?int $offset, ?int $limit = null, ?array $orderBy = null): Promise
public function find(array $criteria, ?int $offset = null, ?int $limit = null, ?array $orderBy = null): Promise
{
return call(
function () use ($criteria, $offset, $limit, $orderBy): \Generator
Expand Down
2 changes: 1 addition & 1 deletion src/Sql/Finder/SimpleSqlFinder.php
Expand Up @@ -78,7 +78,7 @@ function () use ($criteria): \Generator
);
}

public function find(array $criteria, ?int $offset, ?int $limit = null, ?array $orderBy = null): Promise
public function find(array $criteria, ?int $offset = null, ?int $limit = null, ?array $orderBy = null): Promise
{
return call(
function () use ($criteria, $offset, $limit, $orderBy): \Generator
Expand Down
2 changes: 1 addition & 1 deletion src/Sql/Finder/SqlFinder.php
Expand Up @@ -61,5 +61,5 @@ public function findOneBy(array $criteria): Promise;
* @throws \ServiceBus\Storage\Common\Exceptions\StorageInteractingFailed
* @throws \ServiceBus\Storage\Common\Exceptions\ResultSetIterationFailed
*/
public function find(array $criteria, ?int $offset, ?int $limit = null, ?array $orderBy = null): Promise;
public function find(array $criteria, ?int $offset = null, ?int $limit = null, ?array $orderBy = null): Promise;
}
2 changes: 1 addition & 1 deletion tests/Sql/AmpPostgreSQL/AmpPostgreSQLAdapterTest.php
Expand Up @@ -24,7 +24,7 @@
use function ServiceBus\Storage\Sql\AmpPosgreSQL\postgreSqlAdapterFactory;

/**
*
* @group amphp
*/
final class AmpPostgreSQLAdapterTest extends BaseStorageAdapterTest
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Sql/AmpPostgreSQL/AmpPostgreSQLResultSetTest.php
Expand Up @@ -24,7 +24,7 @@
use function ServiceBus\Storage\Sql\fetchOne;

/**
*
* @group amphp
*/
final class AmpPostgreSQLResultSetTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Sql/AmpPostgreSQL/AmpPostgreSQLTransactionTest.php
Expand Up @@ -21,7 +21,7 @@
use function ServiceBus\Storage\Sql\AmpPosgreSQL\postgreSqlAdapterFactory;

/**
*
* @group amphp
*/
final class AmpPostgreSQLTransactionTest extends BaseTransactionTest
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Sql/DoctrineDBAL/DoctrineDBALAdapterTest.php
Expand Up @@ -25,7 +25,7 @@
use function ServiceBus\Storage\Sql\DoctrineDBAL\inMemoryAdapter;

/**
*
* @group inmemory
*/
final class DoctrineDBALAdapterTest extends BaseStorageAdapterTest
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Sql/DoctrineDBAL/DoctrineDBALResultSetTest.php
Expand Up @@ -24,7 +24,7 @@
use function ServiceBus\Storage\Sql\fetchOne;

/**
*
* @group inmemory
*/
final class DoctrineDBALResultSetTest extends TestCase
{
Expand Down
2 changes: 1 addition & 1 deletion tests/Sql/DoctrineDBAL/DoctrineDBALTransactionTest.php
Expand Up @@ -21,7 +21,7 @@
use function ServiceBus\Storage\Sql\DoctrineDBAL\inMemoryAdapter;

/**
*
* @group inmemory
*/
final class DoctrineDBALTransactionTest extends BaseTransactionTest
{
Expand Down
23 changes: 16 additions & 7 deletions tests/Sql/Finder/CachedSqlFinderTest.php
Expand Up @@ -10,7 +10,7 @@
* @license https://opensource.org/licenses/MIT
*/

declare(strict_types=1);
declare(strict_types = 1);

namespace ServiceBus\Storage\Tests\Sql\Finder;

Expand All @@ -20,6 +20,7 @@
use ServiceBus\Storage\Common\DatabaseAdapter;
use ServiceBus\Storage\Sql\Finder\CachedSqlFinder;
use function Amp\Promise\wait;
use function Latitude\QueryBuilder\criteria;
use function ServiceBus\Common\uuid;
use function ServiceBus\Storage\Sql\DoctrineDBAL\inMemoryAdapter;

Expand Down Expand Up @@ -68,7 +69,7 @@ protected function tearDown(): void
public function selectOne(): void
{
Loop::run(
static function (): \Generator
static function(): \Generator
{
yield self::$adapter->execute(
'INSERT INTO qwerty(id, title) VALUES(?,?), (?,?)',
Expand All @@ -91,7 +92,7 @@ static function (): \Generator

/** @noinspection PhpInternalEntityUsedInspection */
self::assertTrue(
InMemoryStorage::instance()->has('6e1488a47d01310e8697f3e980935b2d4d2c8df3')
InMemoryStorage::instance()->has('5b601b4ee0e739b9a3e13dbf08a5aa6c00898de4')
);

/** @var array $entry */
Expand All @@ -111,7 +112,7 @@ static function (): \Generator
public function selectAll(): void
{
Loop::run(
static function (): \Generator
static function(): \Generator
{
yield self::$adapter->execute(
'INSERT INTO qwerty(id, title) VALUES(?,?), (?,?)',
Expand All @@ -121,19 +122,27 @@ static function (): \Generator
$finder = new CachedSqlFinder('qwerty', self::$adapter);

/** @var array $rows */
$rows = yield $finder->find([], 100, ['id' => 'DESC']);
$rows = yield $finder->find(
criteria: [],
limit: 100,
orderBy: ['id' => 'DESC']
);

self::assertCount(2, $rows);

/** Cached */

/** @noinspection PhpInternalEntityUsedInspection */
self::assertTrue(
InMemoryStorage::instance()->has('5c2a559f629ec7eb8cc42876c6fec726b3ab82f2')
InMemoryStorage::instance()->has('eab2eef3f648338cde6ccef7ec84db4041ef6266')
);

/** @var array $rows */
$rows = yield $finder->find([], 100, ['id' => 'DESC']);
$rows = yield $finder->find(
criteria: [],
limit: 100,
orderBy: ['id' => 'DESC']
);

self::assertCount(2, $rows);
}
Expand Down
12 changes: 8 additions & 4 deletions tests/Sql/Finder/SimpleSqlFinderTest.php
Expand Up @@ -10,7 +10,7 @@
* @license https://opensource.org/licenses/MIT
*/

declare(strict_types=1);
declare(strict_types = 1);

namespace ServiceBus\Storage\Tests\Sql\Finder;

Expand Down Expand Up @@ -68,7 +68,7 @@ protected function tearDown(): void
public function selectOne(): void
{
Loop::run(
static function (): \Generator
static function(): \Generator
{
yield self::$adapter->execute(
'INSERT INTO qwerty(id, title) VALUES(?,?), (?,?)',
Expand Down Expand Up @@ -96,7 +96,7 @@ static function (): \Generator
public function selectAll(): void
{
Loop::run(
static function (): \Generator
static function(): \Generator
{
yield self::$adapter->execute(
'INSERT INTO qwerty(id, title) VALUES(?,?), (?,?)',
Expand All @@ -106,7 +106,11 @@ static function (): \Generator
$finder = new SimpleSqlFinder('qwerty', self::$adapter);

/** @var array $rows */
$rows = yield $finder->find([], 100, ['id' => 'DESC']);
$rows = yield $finder->find(
criteria: [],
limit: 100,
orderBy: ['id' => 'DESC']
);

self::assertCount(2, $rows);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Sql/Migration/SqlMigrationProcessorTest.php
Expand Up @@ -19,7 +19,7 @@
use ServiceBus\Storage\Sql\Migration\SqlMigrationLoader;
use ServiceBus\Storage\Sql\Migration\SqlMigrationProcessor;
use function Amp\Promise\wait;
use function ServiceBus\Storage\Sql\AmpPosgreSQL\postgreSqlAdapterFactory;
use function ServiceBus\Storage\Sql\DoctrineDBAL\inMemoryAdapter;

/**
*
Expand All @@ -40,7 +40,7 @@ protected function setUp(): void
{
parent::setUp();

$this->storage = postgreSqlAdapterFactory((string) \getenv('TEST_POSTGRES_DSN'));
$this->storage = inMemoryAdapter();
$this->migrationProcessor = new SqlMigrationProcessor(
$this->storage,
new SqlMigrationLoader(__DIR__ . '/stubs')
Expand Down
4 changes: 2 additions & 2 deletions tests/Sql/Migration/stubs/Version201912201932.php
Expand Up @@ -16,11 +16,11 @@ final class Version201912201932 extends Migration
{
protected function up(): void
{
$this->add('SELECT NOW()');
$this->add('SELECT date(\'now\')');
}

protected function down(): void
{
$this->add('SELECT NOW()');
$this->add('SELECT date(\'now\')');
}
}
2 changes: 1 addition & 1 deletion tests/Sql/Migration/stubs/Version202001152036.php
Expand Up @@ -19,7 +19,7 @@ final class Version202001152036 extends Migration
{
protected function up(): void
{
$this->add('SELECT NOW()');
$this->add('SELECT date(\'now\')');
}

protected function down(): void
Expand Down

0 comments on commit 731180b

Please sign in to comment.