public function testFindMatching()
{
$users = $this->usersTable->find()->matching('Posts', function ($q) {
return $q->where(['Posts.id' => 1]);
});
$this->assertEquals(1, $users->count());
$post = $this->postsTable->get(1);
$this->postsTable->delete($post);
$posts = $this->postsTable->find('all', ['withDeleted'])->where(['id' => 1]);
$this->assertEquals(1, $posts->count());
$users = $this->usersTable->find()->matching('Posts', function ($q) {
return $q->where(['Posts.id' => 1]);
});
$this->assertEquals(0, $users->count());
}