Increment assertion count manually
Which is needed to test void methods that shouldn't raise any exception on a certain condition. If the interpreter gets to the point where the assertion count is incremented it means that no exceptions have been thrown and our test is successful. Important to note that some tests were slighly refactored to simplify things a bit.
This commit is contained in:
parent
8d144daf01
commit
1bf884970f
@ -179,6 +179,8 @@ class ConfigurationTest extends TestCase
|
|||||||
{
|
{
|
||||||
$this->setProductionSettings();
|
$this->setProductionSettings();
|
||||||
$this->configuration->ensureProductionSettings();
|
$this->configuration->ensureProductionSettings();
|
||||||
|
|
||||||
|
$this->addToAssertionCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testEnsureProductionSettingsQueryCache()
|
public function testEnsureProductionSettingsQueryCache()
|
||||||
|
@ -301,6 +301,7 @@ class ClassTableInheritanceTest extends OrmFunctionalTestCase
|
|||||||
->setParameter(1, 'IT')
|
->setParameter(1, 'IT')
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
$this->addToAssertionCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,6 +37,8 @@ class LockTest extends OrmFunctionalTestCase
|
|||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
|
|
||||||
$this->_em->lock($article, LockMode::OPTIMISTIC, $article->version);
|
$this->_em->lock($article, LockMode::OPTIMISTIC, $article->version);
|
||||||
|
|
||||||
|
$this->addToAssertionCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,6 +178,8 @@ class OptimisticTest extends OrmFunctionalTestCase
|
|||||||
$proxy = $this->_em->getReference(OptimisticStandard::class, $test->id);
|
$proxy = $this->_em->getReference(OptimisticStandard::class, $test->id);
|
||||||
|
|
||||||
$this->_em->lock($proxy, LockMode::OPTIMISTIC, 1);
|
$this->_em->lock($proxy, LockMode::OPTIMISTIC, 1);
|
||||||
|
|
||||||
|
$this->addToAssertionCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testOptimisticTimestampSetsDefaultValue()
|
public function testOptimisticTimestampSetsDefaultValue()
|
||||||
|
@ -36,6 +36,8 @@ class PersistentObjectTest extends OrmFunctionalTestCase
|
|||||||
|
|
||||||
$this->_em->persist($entity);
|
$this->_em->persist($entity);
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
|
|
||||||
|
$this->addToAssertionCount(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFind()
|
public function testFind()
|
||||||
|
@ -46,27 +46,17 @@ class DDC3170Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
$this->_em->clear();
|
$this->_em->clear();
|
||||||
|
|
||||||
try {
|
$this->_em->createQueryBuilder()
|
||||||
$this->_em->createQueryBuilder()
|
->select('p')
|
||||||
->select('p')
|
->from(DDC3170ProductJoined::class, 'p')
|
||||||
->from(DDC3170ProductJoined::class, 'p')
|
->getQuery()
|
||||||
->getQuery()
|
->getResult(AbstractQuery::HYDRATE_SIMPLEOBJECT);
|
||||||
->getResult(AbstractQuery::HYDRATE_SIMPLEOBJECT);
|
|
||||||
} catch (HydrationException $e) // Thrown by SimpleObjectHydrator
|
|
||||||
{
|
|
||||||
$this->fail('Failed correct mapping of discriminator column when using simple object hydration and class table inheritance');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
$this->_em->createQueryBuilder()
|
||||||
$this->_em->createQueryBuilder()
|
->select('p')
|
||||||
->select('p')
|
->from(DDC3170ProductSingleTable::class, 'p')
|
||||||
->from(DDC3170ProductSingleTable::class, 'p')
|
->getQuery()
|
||||||
->getQuery()
|
->getResult(AbstractQuery::HYDRATE_SIMPLEOBJECT);
|
||||||
->getResult(AbstractQuery::HYDRATE_SIMPLEOBJECT);
|
|
||||||
} catch (HydrationException $e) // Thrown by SimpleObjectHydrator
|
|
||||||
{
|
|
||||||
$this->fail('Failed correct mapping of discriminator column when using simple object hydration and single table inheritance');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ class DDC588Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
// Following should not result in exception
|
// Following should not result in exception
|
||||||
$this->_em->refresh($site);
|
$this->_em->refresh($site);
|
||||||
|
|
||||||
|
$this->addToAssertionCount(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ class DDC742Test extends \Doctrine\Tests\OrmFunctionalTestCase
|
|||||||
$user->favoriteComments->add($this->_em->find(DDC742Comment::class, $comment3->id));
|
$user->favoriteComments->add($this->_em->find(DDC742Comment::class, $comment3->id));
|
||||||
|
|
||||||
$this->_em->flush();
|
$this->_em->flush();
|
||||||
|
$this->addToAssertionCount(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,64 +24,28 @@ class SchemaValidatorTest extends OrmTestCase
|
|||||||
$this->validator = new SchemaValidator($this->em);
|
$this->validator = new SchemaValidator($this->em);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCmsModelSet()
|
/**
|
||||||
|
* @dataProvider modelSetProvider
|
||||||
|
*/
|
||||||
|
public function testCmsModelSet(string $path)
|
||||||
{
|
{
|
||||||
$this->em->getConfiguration()->getMetadataDriverImpl()->addPaths(
|
$this->em->getConfiguration()
|
||||||
[
|
->getMetadataDriverImpl()
|
||||||
__DIR__ . "/../../Models/CMS"
|
->addPaths([$path]);
|
||||||
]
|
|
||||||
);
|
|
||||||
$this->validator->validateMapping();
|
$this->validator->validateMapping();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCompanyModelSet()
|
public function modelSetProvider(): array
|
||||||
{
|
{
|
||||||
$this->em->getConfiguration()->getMetadataDriverImpl()->addPaths(
|
return [
|
||||||
[
|
'cms' => [__DIR__ . '/../../Models/CMS'],
|
||||||
__DIR__ . "/../../Models/Company"
|
'company' => [__DIR__ . '/../../Models/Company'],
|
||||||
]
|
'ecommerce' => [__DIR__ . '/../../Models/ECommerce'],
|
||||||
);
|
'forum' => [__DIR__ . '/../../Models/Forum'],
|
||||||
$this->validator->validateMapping();
|
'navigation' => [__DIR__ . '/../../Models/Navigation'],
|
||||||
}
|
'routing' => [__DIR__ . '/../../Models/Routing'],
|
||||||
|
];
|
||||||
public function testECommerceModelSet()
|
|
||||||
{
|
|
||||||
$this->em->getConfiguration()->getMetadataDriverImpl()->addPaths(
|
|
||||||
[
|
|
||||||
__DIR__ . "/../../Models/ECommerce"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$this->validator->validateMapping();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testForumModelSet()
|
|
||||||
{
|
|
||||||
$this->em->getConfiguration()->getMetadataDriverImpl()->addPaths(
|
|
||||||
[
|
|
||||||
__DIR__ . "/../../Models/Forum"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$this->validator->validateMapping();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testNavigationModelSet()
|
|
||||||
{
|
|
||||||
$this->em->getConfiguration()->getMetadataDriverImpl()->addPaths(
|
|
||||||
[
|
|
||||||
__DIR__ . "/../../Models/Navigation"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$this->validator->validateMapping();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testRoutingModelSet()
|
|
||||||
{
|
|
||||||
$this->em->getConfiguration()->getMetadataDriverImpl()->addPaths(
|
|
||||||
[
|
|
||||||
__DIR__ . "/../../Models/Routing"
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$this->validator->validateMapping();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user