EZP-21324: Added tests

Taken from https://github.com/ezsystems/ezpublish-legacy/pull/792