Skip to content
This repository has been archived by the owner on Nov 11, 2020. It is now read-only.

Commit

Permalink
Refactor map/reduce options test in QueryTest
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola committed Jul 12, 2012
1 parent bf542f0 commit eabc12d
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions tests/Doctrine/MongoDB/Tests/Query/QueryTest.php
Expand Up @@ -6,25 +6,18 @@


class QueryTest extends \PHPUnit_Framework_TestCase class QueryTest extends \PHPUnit_Framework_TestCase
{ {
const MAP_REDUCE_OPTION_KEY = 'limit';
const MAP_REDUCE_OPTION_VALUE = 10;

public function testMapReduceOptionsArePassed() public function testMapReduceOptionsArePassed()
{ {
$collection = $this->getMockCollection(); $collection = $this->getMockCollection();


$mapReduceOptions = array(
self::MAP_REDUCE_OPTION_KEY => self::MAP_REDUCE_OPTION_VALUE
);

$queryArray = array( $queryArray = array(
'type' => Query::TYPE_MAP_REDUCE, 'type' => Query::TYPE_MAP_REDUCE,
'mapReduce' => array( 'mapReduce' => array(
'map' => '', 'map' => '',
'reduce' => '', 'reduce' => '',
'options' => $mapReduceOptions 'options' => array('limit' => 10),
), ),
'query' => array() 'query' => array()
); );


$query = new Query( $query = new Query(
Expand All @@ -41,13 +34,7 @@ public function testMapReduceOptionsArePassed()
$this->anything(), $this->anything(),
$this->anything(), $this->anything(),
$this->anything(), $this->anything(),
$this->logicalAnd( new ArrayHasValueUnderKey('limit', 10)
$this->arrayHasKey(self::MAP_REDUCE_OPTION_KEY),
new ArrayHasValueUnderKey(
self::MAP_REDUCE_OPTION_KEY,
self::MAP_REDUCE_OPTION_VALUE
)
)
); );


$query->execute(); $query->execute();
Expand Down

0 comments on commit eabc12d

Please sign in to comment.