$this->manufacturerRepository =
$this->
getContainer()->
get('product_manufacturer.repository'
);
$this->connection =
$this->
getContainer()->
get(Connection::
class);
$this->url = '/api';
} /**
* TOTAL-COUNT-MODE
*/
public function testListTotalCountMode(): void
{ for ($i = 0;
$i < 35; ++
$i) { $this->
createManufacturer(['link' => 'test'
]);
} // no count, equals to fetched entities
$this->
getBrowser()->
request('GET',
$this->url . '/product-manufacturer',
['total-count-mode' => Criteria::TOTAL_COUNT_MODE_NONE, 'filter' =>
['product_manufacturer.link' => 'test'
], 'limit' => 5
]);
static::
assertSame(200,
$this->
getBrowser()->
getResponse()->
getStatusCode(),
$this->
getBrowser()->
getResponse()->
getContent());
$content =
json_decode($this->
getBrowser()->
getResponse()->
getContent(), true, 512, \JSON_THROW_ON_ERROR
);
static::
assertEquals(5,
$content['meta'
]['total'
],
print_r($content, true
));
// calculates all matching rows
$this->
getBrowser()->
request('GET',
$this->url . '/product-manufacturer',
['total-count-mode' => Criteria::TOTAL_COUNT_MODE_EXACT, 'filter' =>
['product_manufacturer.link' => 'test'
], 'limit' => 5
]);