diff --git a/.github/workflows/build-ci-atlas.yml b/.github/workflows/build-ci-atlas.yml index c699d2023..46f30150d 100644 --- a/.github/workflows/build-ci-atlas.yml +++ b/.github/workflows/build-ci-atlas.yml @@ -91,4 +91,4 @@ jobs: - name: "Run tests" run: | export MONGODB_URI="mongodb://127.0.0.1:27017/?directConnection=true" - ./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search + php -d zend.assertions=1 ./vendor/bin/phpunit --coverage-clover coverage.xml --group atlas-search diff --git a/.github/workflows/build-ci.yml b/.github/workflows/build-ci.yml index 6fec7bb28..bbc8b53d1 100644 --- a/.github/workflows/build-ci.yml +++ b/.github/workflows/build-ci.yml @@ -118,4 +118,4 @@ jobs: - name: "Run tests" run: | export MONGODB_URI="mongodb://127.0.0.1:27017/?replicaSet=rs" - ./vendor/bin/phpunit --coverage-clover coverage.xml --exclude-group atlas-search + php -d zend.assertions=1 ./vendor/bin/phpunit --coverage-clover coverage.xml --exclude-group atlas-search diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 7044f9069..d7f066483 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -23,6 +23,8 @@ + + ['root' => 'bson'], ], ); - assert($result instanceof Document); - return $result ? (string) $result->payload : false; + if ($result instanceof Document) { + return (string) $result->payload; + } + + return false; } public function write($sessionId, $data): bool diff --git a/tests/ConnectionTest.php b/tests/ConnectionTest.php index ba5e09804..75761080e 100644 --- a/tests/ConnectionTest.php +++ b/tests/ConnectionTest.php @@ -63,7 +63,7 @@ public function testDisconnectAndCreateNewConnection() public function testDb() { $connection = DB::connection('mongodb'); - $this->assertInstanceOf(Database::class, $connection->getMongoDB()); + $this->assertInstanceOf(Database::class, $connection->getDatabase()); $this->assertInstanceOf(Client::class, $connection->getClient()); } @@ -199,7 +199,7 @@ public function testConnectionConfig(string $expectedUri, string $expectedDataba $client = $connection->getClient(); $this->assertSame($expectedUri, (string) $client); - $this->assertSame($expectedDatabaseName, $connection->getMongoDB()->getDatabaseName()); + $this->assertSame($expectedDatabaseName, $connection->getDatabase()->getDatabaseName()); $this->assertSame('foo', $connection->getCollection('foo')->getCollectionName()); $this->assertSame('foo', $connection->table('foo')->raw()->getCollectionName()); } diff --git a/tests/FilesystemsTest.php b/tests/FilesystemsTest.php index 3b9fa8e5f..7b8141905 100644 --- a/tests/FilesystemsTest.php +++ b/tests/FilesystemsTest.php @@ -56,7 +56,7 @@ public static function provideValidOptions(): Generator 'driver' => 'gridfs', 'bucket' => static fn (Application $app) => $app['db'] ->connection('mongodb') - ->getMongoDB() + ->getDatabase() ->selectGridFSBucket(), ], ]; @@ -68,7 +68,7 @@ public function testValidOptions(array $options) // Service used by "bucket-service" $this->app->singleton('bucket', static fn (Application $app) => $app['db'] ->connection('mongodb') - ->getMongoDB() + ->getDatabase() ->selectGridFSBucket()); $this->app['config']->set('filesystems.disks.' . $this->dataName(), $options); @@ -145,6 +145,6 @@ public function testPrefix() private function getBucket(): Bucket { - return DB::connection('mongodb')->getMongoDB()->selectGridFSBucket(); + return DB::connection('mongodb')->getDatabase()->selectGridFSBucket(); } }