|
@@ 59-90 (lines=32) @@
|
| 56 |
|
$this->assertEquals($expectedQuery, $result); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
public function testDispatchMoreThanOneFilter() |
| 60 |
|
{ |
| 61 |
|
$inputArray = array( |
| 62 |
|
'Filter' => ['ContentTypeIdentifierCriterion' => 'article', 'ParentLocationIdCriterion' => 762], |
| 63 |
|
'Criteria' => [], |
| 64 |
|
'Query' => [], |
| 65 |
|
); |
| 66 |
|
|
| 67 |
|
$parsingDispatcher = $this->getParsingDispatcherMock(); |
| 68 |
|
$parsingDispatcher |
| 69 |
|
->expects($this->at(0)) |
| 70 |
|
->method('parse') |
| 71 |
|
->with(['ContentTypeIdentifierCriterion' => 'article']) |
| 72 |
|
->will($this->returnValue(new Query\Criterion\ContentTypeIdentifier('article'))); |
| 73 |
|
$parsingDispatcher |
| 74 |
|
->expects($this->at(1)) |
| 75 |
|
->method('parse') |
| 76 |
|
->with(['ParentLocationIdCriterion' => 762]) |
| 77 |
|
->will($this->returnValue(new Query\Criterion\ParentLocationId(762))); |
| 78 |
|
|
| 79 |
|
$parser = $this->getParser(); |
| 80 |
|
|
| 81 |
|
$result = $parser->parse($inputArray, $parsingDispatcher); |
| 82 |
|
|
| 83 |
|
$expectedQuery = new Query(); |
| 84 |
|
$expectedQuery->filter = new Query\Criterion\LogicalAnd([ |
| 85 |
|
new Query\Criterion\ContentTypeIdentifier('article'), |
| 86 |
|
new Query\Criterion\ParentLocationId(762), |
| 87 |
|
]); |
| 88 |
|
|
| 89 |
|
$this->assertEquals($expectedQuery, $result); |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
public function testDispatchOneQueryItem() |
| 93 |
|
{ |
|
@@ 117-148 (lines=32) @@
|
| 114 |
|
$this->assertEquals($expectedQuery, $result); |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
public function testDispatchMoreThanOneQueryItem() |
| 118 |
|
{ |
| 119 |
|
$inputArray = array( |
| 120 |
|
'Query' => ['ContentTypeIdentifierCriterion' => 'article', 'ParentLocationIdCriterion' => 762], |
| 121 |
|
'Criteria' => [], |
| 122 |
|
'Filter' => [], |
| 123 |
|
); |
| 124 |
|
|
| 125 |
|
$parsingDispatcher = $this->getParsingDispatcherMock(); |
| 126 |
|
$parsingDispatcher |
| 127 |
|
->expects($this->at(0)) |
| 128 |
|
->method('parse') |
| 129 |
|
->with(['ContentTypeIdentifierCriterion' => 'article']) |
| 130 |
|
->will($this->returnValue(new Query\Criterion\ContentTypeIdentifier('article'))); |
| 131 |
|
$parsingDispatcher |
| 132 |
|
->expects($this->at(1)) |
| 133 |
|
->method('parse') |
| 134 |
|
->with(['ParentLocationIdCriterion' => 762]) |
| 135 |
|
->will($this->returnValue(new Query\Criterion\ParentLocationId(762))); |
| 136 |
|
|
| 137 |
|
$parser = $this->getParser(); |
| 138 |
|
|
| 139 |
|
$result = $parser->parse($inputArray, $parsingDispatcher); |
| 140 |
|
|
| 141 |
|
$expectedQuery = new Query(); |
| 142 |
|
$expectedQuery->query = new Query\Criterion\LogicalAnd([ |
| 143 |
|
new Query\Criterion\ContentTypeIdentifier('article'), |
| 144 |
|
new Query\Criterion\ParentLocationId(762), |
| 145 |
|
]); |
| 146 |
|
|
| 147 |
|
$this->assertEquals($expectedQuery, $result); |
| 148 |
|
} |
| 149 |
|
|
| 150 |
|
/** |
| 151 |
|
* Returns the session input parser. |