From 6569685ae56db32f557abaee6b2022a35344c490 Mon Sep 17 00:00:00 2001 From: addshore Date: Sat, 14 Oct 2017 17:27:42 +0100 Subject: [PATCH] RevisionUnitTest for fetchFromConds Change-Id: Ie151123d703933474a52c73beacb0ac70161c241 --- tests/phpunit/includes/RevisionUnitTest.php | 35 +++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/tests/phpunit/includes/RevisionUnitTest.php b/tests/phpunit/includes/RevisionUnitTest.php index 24f0b6493b..89f5a0ecc4 100644 --- a/tests/phpunit/includes/RevisionUnitTest.php +++ b/tests/phpunit/includes/RevisionUnitTest.php @@ -1,5 +1,7 @@ getMock( IDatabase::class ); + $db->expects( $this->once() ) + ->method( 'selectRow' ) + ->with( + $this->equalTo( [ 'revision', 'page', 'user' ] ), + // We don't really care about the fields are they come from the selectField methods + $this->isType( 'array' ), + $this->equalTo( $conditions ), + // Method name + $this->equalTo( 'Revision::fetchFromConds' ), + $this->equalTo( $options ), + // We don't really care about the join conds are they come from the joinCond methods + $this->isType( 'array' ) + ) + ->willReturn( 'RETURNVALUE' ); + + $wrapper = TestingAccessWrapper::newFromClass( Revision::class ); + $result = $wrapper->fetchFromConds( $db, $conditions, $flags ); + + $this->assertEquals( 'RETURNVALUE', $result ); + } } -- 2.20.1