Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lav45 committed Jun 1, 2024
1 parent b81bade commit 2f10a39
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/framework/data/ActiveDataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,23 @@ public function testDoesNotPerformQueryWhenHasNoModels()

$this->assertEquals(0, $pagination->getPageCount());
}

public function testTotalCountAfterSearch()
{
$query = Order::find();
$provider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => 2,
],
]);

$pagination = $provider->getPagination();
$this->assertEquals(2, $pagination->getPageCount());
$this->assertEquals(3, $pagination->getTotalCount());

$query->andWhere(['customer_id' => 2]);
$this->assertEquals(1, $pagination->getPageCount());
$this->assertEquals(2, $pagination->getTotalCount());
}
}

0 comments on commit 2f10a39

Please sign in to comment.