Merge "kafka: Implement ack handling"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 29 Jun 2016 12:18:45 +0000 (12:18 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 29 Jun 2016 12:18:45 +0000 (12:18 +0000)
1  2 
tests/phpunit/includes/debug/logger/monolog/KafkaHandlerTest.php

@@@ -23,6 -23,9 +23,6 @@@ namespace MediaWiki\Logger\Monolog
  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() {
@@@ -55,6 -58,9 +55,9 @@@
                $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( [
@@@ -86,6 -92,9 +89,9 @@@
                $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() )