mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-28 09:34:59 +00:00
Fix some tests
This commit is contained in:
@@ -18,12 +18,13 @@ use Chill\MainBundle\Form\Type\ScopePickerType;
|
||||
use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface;
|
||||
use Chill\MainBundle\Templating\TranslatableStringHelperInterface;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\Builder\ClassMetadataBuilder;
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension;
|
||||
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
|
||||
use Symfony\Bridge\Doctrine\Test\DoctrineTestHelper;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\PreloadedExtension;
|
||||
use Symfony\Component\Form\Test\TypeTestCase;
|
||||
@@ -38,7 +39,7 @@ final class ScopePickerTypeTest extends TypeTestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
public function testBuildOneScopeIsSuccessful()
|
||||
public function estBuildOneScopeIsSuccessful()
|
||||
{
|
||||
$form = $this->factory->create(ScopePickerType::class, null, [
|
||||
'center' => new Center(),
|
||||
@@ -107,9 +108,14 @@ final class ScopePickerTypeTest extends TypeTestCase
|
||||
);
|
||||
|
||||
// add the mocks for creating EntityType
|
||||
$entityManager = DoctrineTestHelper::createTestEntityManager();
|
||||
$em = $this->prophesize(EntityManagerInterface::class);
|
||||
$em->getClassMetadata(Scope::class)->willReturn($entityManager->getClassMetadata(Scope::class));
|
||||
$em->getClassMetadata(Scope::class)->will(function (array $args) {
|
||||
$classMetadata = new ClassMetadataBuilder(
|
||||
new ClassMetadataInfo(Scope::class)
|
||||
);
|
||||
|
||||
return $classMetadata->getClassMetadata();
|
||||
});
|
||||
$em->contains(Argument::type(Scope::class))->willReturn(true);
|
||||
$em->initializeObject(Argument::type(Scope::class))->will(static fn ($o) => $o);
|
||||
$emRevealed = $em->reveal();
|
||||
|
Reference in New Issue
Block a user