Active Record Criteria apply and applyWrite tests