use MediaWikiTestCase;
use Monolog\Logger;
-// not available in the version of phpunit mw uses, so copied into repo
-require_once __DIR__ . '/../../../phpunit/ConsecutiveParametersMatcher.php';
-
class KafkaHandlerTest extends MediaWikiTestCase {
protected function setUp() {
$produce->expects( $this->once() )
->method( 'setMessages' )
->with( $expect, $this->anything(), $this->anything() );
+ $produce->expects( $this->any() )
+ ->method( 'send' )
+ ->will( $this->returnValue( true ) );
$handler = new KafkaHandler( $produce, $options );
$handler->handle( [
$produce->expects( $this->any() )
->method( 'getAvailablePartitions' )
->will( $this->throwException( new \Kafka\Exception ) );
+ $produce->expects( $this->any() )
+ ->method( 'send' )
+ ->will( $this->returnValue( true ) );
if ( $expectException ) {
$this->setExpectedException( 'Kafka\Exception' );
->will( $this->returnValue( [ 'A' ] ) );
$mockMethod = $produce->expects( $this->exactly( 2 ) )
->method( 'setMessages' );
+ $produce->expects( $this->any() )
+ ->method( 'send' )
+ ->will( $this->returnValue( true ) );
// evil hax
\TestingAccessWrapper::newFromObject( $mockMethod )->matcher->parametersMatcher =
new \PHPUnit_Framework_MockObject_Matcher_ConsecutiveParameters( [
$produce->expects( $this->once() )
->method( 'setMessages' )
->with( $this->anything(), $this->anything(), [ 'words', 'lines' ] );
+ $produce->expects( $this->any() )
+ ->method( 'send' )
+ ->will( $this->returnValue( true ) );
$formatter = $this->getMock( 'Monolog\Formatter\FormatterInterface' );
$formatter->expects( $this->any() )