Add counter cache test for class_name

Backport test from #14410
Merge pull request #14413 from arthurnn/port_test_cc

Add counter cache test for class_name