createNoOpMock( HookContainer::class, [ 'run' ] ); $container->expects( $this->once() ) ->method( 'run' ) ->with( 'VisualEditorApiVisualEditorEditPreSave', $this->isType( 'array' ), [ 'abortable' => true ] ) ->willReturn( true ); $runner = new VisualEditorHookRunner( $container ); $apiResponse = []; $result = $runner->onVisualEditorApiVisualEditorEditPreSave( PageIdentityValue::localIdentity( 0, 0, 'test' ), UserIdentityValue::newAnonymous( '' ), '', [], [], $apiResponse ); $this->assertTrue( $result ); } public function testPostSaveHook() { $container = $this->createNoOpMock( HookContainer::class, [ 'run' ] ); $container->expects( $this->once() ) ->method( 'run' ) ->with( 'VisualEditorApiVisualEditorEditPostSave', $this->isType( 'array' ), [ 'abortable' => false ] ); $runner = new VisualEditorHookRunner( $container ); $apiResponse = []; $runner->onVisualEditorApiVisualEditorEditPostSave( PageIdentityValue::localIdentity( 0, 0, 'test' ), UserIdentityValue::newAnonymous( '' ), '', [], [], [], $apiResponse ); } }