Skip to content

Commit

Permalink
remove Validation tests because behavior changed
Browse files Browse the repository at this point in the history
  • Loading branch information
IonBazan committed Jul 25, 2021
1 parent c84b6c3 commit d72e3d3
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,70 +4,20 @@

namespace Doctrine\ODM\MongoDB\Tests\Mapping\Annotations;

use Doctrine\Common\Annotations\AnnotationException;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
use Doctrine\ODM\MongoDB\Tests\BaseTest;
use TypeError;

class ValidationTest extends BaseTest
{
public function testWrongTypeForValidationValidatorShouldThrowException()
public function testWrongTypeForValidationValidatorShouldThrowException(): void
{
$this->expectException(TypeError::class);
$this->expectExceptionMessage('Argument #1 ($validator) must be of type ?string, array given');
$this->dm->getClassMetadata(WrongTypeForValidationValidator::class);
}

public function testWrongTypeForValidationActionShouldThrowException()
{
$this->expectException(TypeError::class);
$this->expectExceptionMessage('[Type Error] Attribute "action" of @ODM\Validation declared on class Doctrine\ODM\MongoDB\Tests\Mapping\Annotations\WrongTypeForValidationAction expects a(n) string, but got boolean.');
$this->dm->getClassMetadata(WrongTypeForValidationAction::class);
}

public function testWrongValueForValidationActionShouldThrowException()
{
$this->expectException(AnnotationException::class);
$this->expectExceptionMessageMatches('#^\[Enum Error\] Attribute "action" of @Doctrine\\\\ODM\\\\MongoDB\\\\Mapping\\\\Annotations\\\\Validation declared on class Doctrine\\\\ODM\\\\MongoDB\\\\Tests\\\\Mapping\\\\Annotations\\\\WrongValueForValidationAction accepts? only \[error, warn\], but got wrong\.$#');
$this->dm->getClassMetadata(WrongValueForValidationAction::class);
}

public function testWrongTypeForValidationLevelShouldThrowException()
{
$this->expectException(AnnotationException::class);
$this->expectExceptionMessage('[Type Error] Attribute "level" of @ODM\Validation declared on class Doctrine\ODM\MongoDB\Tests\Mapping\Annotations\WrongTypeForValidationLevel expects a(n) string, but got boolean.');
$this->dm->getClassMetadata(WrongTypeForValidationLevel::class);
}

public function testWrongValueForValidationLevelShouldThrowException()
{
$this->expectException(AnnotationException::class);
$this->expectExceptionMessageMatches('#^\[Enum Error\] Attribute "level" of @Doctrine\\\\ODM\\\\MongoDB\\\\Mapping\\\\Annotations\\\\Validation declared on class Doctrine\\\\ODM\\\\MongoDB\\\\Tests\\\\Mapping\\\\Annotations\\\\WrongValueForValidationLevel accepts? only \[off, strict, moderate\], but got wrong\.$#');
$this->dm->getClassMetadata(WrongValueForValidationLevel::class);
}
}

/** @ODM\Validation(validator={"wrong"}) */
class WrongTypeForValidationValidator
{
}

/** @ODM\Validation(action=true) */
class WrongTypeForValidationAction
{
}

/** @ODM\Validation(action="wrong") */
class WrongValueForValidationAction
{
}

/** @ODM\Validation(level=true) */
class WrongTypeForValidationLevel
{
}

/** @ODM\Validation(level="wrong") */
class WrongValueForValidationLevel
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@

class CollWithPHP80Types extends ArrayCollection
{
/**
* @psalm-suppress ReservedWord
*/
public function mixed(mixed $param) : mixed
{
return $param;
Expand Down

0 comments on commit d72e3d3

Please sign in to comment.