Skip to content

Commit

Permalink
tests: Replace deprecated at() matcher
Browse files Browse the repository at this point in the history
sebastianbergmann/phpunit#4297

The last assertion was not reached and now removed

Change-Id: I81e32ba668802c26afe9a73db8c5243e8136f373
  • Loading branch information
umherirrender committed Apr 18, 2023
1 parent 5b1b9d0 commit bd556a4
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions tests/Sanitizer/SanitizerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,27 +146,18 @@ public function testSanitizeList() {
$sanitizer2 = $this->getMockBuilder( Sanitizer::class )
->onlyMethods( [ 'doSanitize', 'getSanitizationErrors', 'clearSanitizationErrors' ] )
->getMock();
// @phan-suppress-next-line PhanDeprecatedFunction
$sanitizer2->expects( $this->at( 0 ) )->method( 'doSanitize' )
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal False positive
->with( $this->identicalTo( $token1i ) )
->willReturn( $token1o );
// @phan-suppress-next-line PhanDeprecatedFunction
$sanitizer2->expects( $this->at( 1 ) )->method( 'doSanitize' )
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal False positive
->with( $this->identicalTo( $token2i ) )
->willReturn( $token2o );
// @phan-suppress-next-line PhanDeprecatedFunction
$sanitizer2->expects( $this->at( 2 ) )->method( 'doSanitize' )
// @phan-suppress-next-line PhanTypeMismatchArgumentProbablyReal False positive
->with( $this->identicalTo( $token3i ) )
->willReturn( $token3o );
// @phan-suppress-next-line PhanDeprecatedFunction
$sanitizer2->expects( $this->at( 3 ) )->method( 'getSanitizationErrors' )
$sanitizer2->expects( $this->exactly( 3 ) )->method( 'doSanitize' )
->withConsecutive(
[ $this->identicalTo( $token1i ) ],
[ $this->identicalTo( $token2i ) ],
[ $this->identicalTo( $token3i ) ]
)->willReturnOnConsecutiveCalls(
$token1o,
$token2o,
$token3o
);
$sanitizer2->expects( $this->exactly( 1 ) )->method( 'getSanitizationErrors' )
->willReturn( [ [ 'foo', 42, 23 ] ] );
// @phan-suppress-next-line PhanDeprecatedFunction
$sanitizer2->expects( $this->at( 4 ) )->method( 'getSanitizationErrors' )
->willReturn( [] );

$list = new ComponentValueList( [ $token1i, $token2i, $token3i ] );
$ret = $sanitizer1->sanitizeList( $sanitizer2, $list );
Expand Down

0 comments on commit bd556a4

Please sign in to comment.