File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,12 +47,13 @@ public function testDeletedPageInvalidatesCache() {
4747 $ registeredCallbacks [$ name ] = $ callback ;
4848 } );
4949
50- $ cacheInvalidator = $ this ->createMock ( CacheInvalidator::class );
51- $ cacheInvalidator ->expects ( $ this ->once () )
52- ->method ( 'invalidateCaches ' )
53- ->with ( $ this ->callback ( function ( Title $ title ) {
54- return $ title ->getDBkey () === 'TestPage ' && $ title ->getNamespace () === NS_MAIN ;
55- } ) );
50+ $ cacheInvalidator = new class implements CacheInvalidator {
51+ public ?Title $ invalidatedTitle = null ;
52+
53+ public function invalidateCaches ( Title $ title ): void {
54+ $ this ->invalidatedTitle = $ title ;
55+ }
56+ };
5657
5758 $ extension = $ this ->createMock ( Extension::class );
5859 $ extension ->method ( 'getSettings ' )
@@ -69,6 +70,9 @@ public function testDeletedPageInvalidatesCache() {
6970
7071 $ this ->assertArrayHasKey ( 'PageDeleteComplete ' , $ registeredCallbacks );
7172 $ registeredCallbacks ['PageDeleteComplete ' ]( $ page );
73+
74+ $ this ->assertSame ( 'TestPage ' , $ cacheInvalidator ->invalidatedTitle ->getDBkey () );
75+ $ this ->assertSame ( NS_MAIN , $ cacheInvalidator ->invalidatedTitle ->getNamespace () );
7276 }
7377
7478 private function newExtension () {
You can’t perform that action at this time.
0 commit comments