createRepositoryMock example

->setInvalidValue('Bar')
            ->setCause([$entity1])
            ->setCode(UniqueEntity::NOT_UNIQUE_ERROR)
            ->assertRaised();
    }

    /** * @dataProvider provideConstraintsWithCustomRepositoryMethod */
    public function testValidateUniquenessUsingCustomRepositoryMethod(UniqueEntity $constraint)
    {
        $repository = $this->createRepositoryMock();
        $repository->expects($this->once())
            ->method('findByCustom')
            ->willReturn([])
        ;
        $this->em = $this->createEntityManagerMock($repository);
        $this->registry = $this->createRegistryMock($this->em);
        $this->validator = $this->createValidator();
        $this->validator->initialize($this->context);

        $entity1 = new SingleIntIdEntity(1, 'foo');

        
Home | Imprint | This part of the site doesn't use cookies.