namespaceExaminer = $this->getMockBuilder( '\SMW\NamespaceExaminer' ) ->disableOriginalConstructor() ->getMock(); $this->articleDelete = $this->getMockBuilder( '\SMW\MediaWiki\Hooks\ArticleDelete' ) ->disableOriginalConstructor() ->getMock(); } public function testCanConstruct() { $this->assertInstanceOf( DeleteAccount::class, new DeleteAccount( $this->namespaceExaminer, $this->articleDelete ) ); } public function testProcess() { $this->namespaceExaminer->expects( $this->any() ) ->method( 'isSemanticEnabled' ) ->with( NS_USER ) ->willReturn( true ); $this->articleDelete->expects( $this->atLeastOnce() ) ->method( 'process' ); $instance = new DeleteAccount( $this->namespaceExaminer, $this->articleDelete ); $this->assertTrue( $instance->process( 'Foo' ) ); } public function testProcess_User() { $this->namespaceExaminer->expects( $this->any() ) ->method( 'isSemanticEnabled' ) ->with( NS_USER ) ->willReturn( true ); $this->articleDelete->expects( $this->atLeastOnce() ) ->method( 'process' ); $user = $this->getMockBuilder( '\MediaWiki\User\User' ) ->disableOriginalConstructor() ->getMock(); $user->expects( $this->once() ) ->method( 'getName' ) ->willReturn( 'Foo' ); $instance = new DeleteAccount( $this->namespaceExaminer, $this->articleDelete ); $this->assertTrue( $instance->process( $user ) ); } }