createMock( Content::class ); $newContent = $this->createMock( Content::class ); $newContent->expects( $this->once() ) ->method( 'equals' ) ->with( $this->equalTo( $originalContent ) ) ->willReturn( false ); $newContent->expects( $this->once() ) ->method( 'isRedirect' ) ->willReturn( false ); $constraint = new AutoSummaryMissingSummaryConstraint( 'UserSummary', 'AutoSummary', false, $newContent, $originalContent ); $this->assertConstraintPassed( $constraint ); } public function testFailure() { $originalContent = $this->createMock( Content::class ); $newContent = $this->createMock( Content::class ); $newContent->expects( $this->once() ) ->method( 'equals' ) ->with( $this->equalTo( $originalContent ) ) ->willReturn( false ); $newContent->expects( $this->once() ) ->method( 'isRedirect' ) ->willReturn( false ); $constraint = new AutoSummaryMissingSummaryConstraint( 'UserSummary', md5( 'UserSummary' ), false, $newContent, $originalContent ); $this->assertConstraintFailed( $constraint, IEditConstraint::AS_SUMMARY_NEEDED ); } }