|
@@ 34-57 (lines=24) @@
|
| 31 |
|
$this->assertEquals($expectedQuery, $result); |
| 32 |
|
} |
| 33 |
|
|
| 34 |
|
public function testDispatchOneFilter() |
| 35 |
|
{ |
| 36 |
|
$inputArray = array( |
| 37 |
|
'Filter' => ['ContentTypeIdentifierCriterion' => 'article'], |
| 38 |
|
'Criteria' => [], |
| 39 |
|
'Query' => [], |
| 40 |
|
); |
| 41 |
|
|
| 42 |
|
$parsingDispatcher = $this->getParsingDispatcherMock(); |
| 43 |
|
$parsingDispatcher |
| 44 |
|
->expects($this->once()) |
| 45 |
|
->method('parse') |
| 46 |
|
->with(['ContentTypeIdentifierCriterion' => 'article']) |
| 47 |
|
->will($this->returnValue(new Query\Criterion\ContentTypeIdentifier('article'))); |
| 48 |
|
|
| 49 |
|
$parser = $this->getParser(); |
| 50 |
|
|
| 51 |
|
$result = $parser->parse($inputArray, $parsingDispatcher); |
| 52 |
|
|
| 53 |
|
$expectedQuery = new Query(); |
| 54 |
|
$expectedQuery->filter = new Query\Criterion\ContentTypeIdentifier('article'); |
| 55 |
|
|
| 56 |
|
$this->assertEquals($expectedQuery, $result); |
| 57 |
|
} |
| 58 |
|
|
| 59 |
|
public function testDispatchMoreThanOneFilter() |
| 60 |
|
{ |
|
@@ 92-115 (lines=24) @@
|
| 89 |
|
$this->assertEquals($expectedQuery, $result); |
| 90 |
|
} |
| 91 |
|
|
| 92 |
|
public function testDispatchOneQueryItem() |
| 93 |
|
{ |
| 94 |
|
$inputArray = array( |
| 95 |
|
'Query' => ['ContentTypeIdentifierCriterion' => 'article'], |
| 96 |
|
'Criteria' => [], |
| 97 |
|
'Filter' => [], |
| 98 |
|
); |
| 99 |
|
|
| 100 |
|
$parsingDispatcher = $this->getParsingDispatcherMock(); |
| 101 |
|
$parsingDispatcher |
| 102 |
|
->expects($this->once()) |
| 103 |
|
->method('parse') |
| 104 |
|
->with(['ContentTypeIdentifierCriterion' => 'article']) |
| 105 |
|
->will($this->returnValue(new Query\Criterion\ContentTypeIdentifier('article'))); |
| 106 |
|
|
| 107 |
|
$parser = $this->getParser(); |
| 108 |
|
|
| 109 |
|
$result = $parser->parse($inputArray, $parsingDispatcher); |
| 110 |
|
|
| 111 |
|
$expectedQuery = new Query(); |
| 112 |
|
$expectedQuery->query = new Query\Criterion\ContentTypeIdentifier('article'); |
| 113 |
|
|
| 114 |
|
$this->assertEquals($expectedQuery, $result); |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
public function testDispatchMoreThanOneQueryItem() |
| 118 |
|
{ |