assertConstraintPassed( $constraint ); } /** * @dataProvider provideCodes */ public function testFailure( string $type, int $errorCode ) { // 1025 > ( 1 * 1024 ) $constraint = new PageSizeConstraint( 1, 1025, $type ); $this->assertConstraintFailed( $constraint, $errorCode ); } public static function provideCodes() { return [ 'Before merge - CONTENT_TOO_BIG' => [ PageSizeConstraint::BEFORE_MERGE, IEditConstraint::AS_CONTENT_TOO_BIG ], 'After merge - MAX_ARTICLE_SIZE' => [ PageSizeConstraint::AFTER_MERGE, IEditConstraint::AS_MAX_ARTICLE_SIZE_EXCEEDED ] ]; } public function testInvalidType() { $this->expectException( InvalidArgumentException::class ); new PageSizeConstraint( 1, 1023, 'FooBar' ); } }