Skip to content

Commit

Permalink
added test cases for config instantiation
Browse files Browse the repository at this point in the history
  • Loading branch information
driehle committed Jan 21, 2024
1 parent 334ee7f commit 8935537
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use Doctrine\ODM\MongoDB\Repository\DocumentRepository;

class DefaultDocumentRepository extends DocumentRepository
class CustomDocumentRepository extends DocumentRepository
{
public function isCustomDefaultDocumentRepository(): bool
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Doctrine/ConfigurationFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
use DoctrineMongoODMModuleTest\AbstractTest;
use DoctrineMongoODMModuleTest\Assets\CustomRepositoryFactory;
use DoctrineMongoODMModuleTest\Assets\CustomType;
use DoctrineMongoODMModuleTest\Assets\DefaultDocumentRepository as CustomDocumentRepository;
use DoctrineMongoODMModuleTest\Assets\CustomDocumentRepository;

Check failure on line 19 in tests/Doctrine/ConfigurationFactoryTest.php

View workflow job for this annotation

GitHub Actions / Coding Standards / Coding Standards (8.2)

Use statements should be sorted alphabetically. The first wrong one is DoctrineMongoODMModuleTest\Assets\CustomDocumentRepository.
use Laminas\ServiceManager\ServiceManager;

use function assert;
Expand Down Expand Up @@ -118,8 +118,8 @@ public function testCreation(): void
$this->assertSame($persistentCollectionGenerator, $config->getPersistentCollectionGenerator());

$this->assertInstanceOf($typeClassName, Type::getType($typeName));
$this->assertSame('stdClass', $config->getClassMetadataFactoryName());
$this->assertSame($repositoryFactory, $config->getRepositoryFactory());

$this->assertSame(CustomDocumentRepository::class, $config->getDefaultDocumentRepositoryClassName());
}
}
6 changes: 3 additions & 3 deletions tests/Doctrine/CustomDefaultRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace DoctrineMongoODMModuleTest\Doctrine;

use DoctrineMongoODMModuleTest\AbstractTest;
use DoctrineMongoODMModuleTest\Assets\DefaultDocumentRepository;
use DoctrineMongoODMModuleTest\Assets\CustomDocumentRepository;
use DoctrineMongoODMModuleTest\Assets\Document\Simple;

use function assert;
Expand All @@ -18,8 +18,8 @@ public function testCustomDefaultRepository(): void

$repository = $documentManager->getRepository(Simple::class);

$this->assertInstanceOf(DefaultDocumentRepository::class, $repository);
assert($repository instanceof DefaultDocumentRepository);
$this->assertInstanceOf(CustomDocumentRepository::class, $repository);
assert($repository instanceof CustomDocumentRepository);
$this->assertTrue($repository->isCustomDefaultDocumentRepository());
}
}
2 changes: 1 addition & 1 deletion tests/testing.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
'configuration' => [
'odm_default' => [
'default_db' => 'doctrineMongoODMModuleTest',
'default_document_repository_class_name' => Assets\DefaultDocumentRepository::class,
'default_document_repository_class_name' => Assets\CustomDocumentRepository::class,
],
],
'connection' => [
Expand Down

0 comments on commit 8935537

Please sign in to comment.