Heres an example:

Code: https://github.com/owncloud/news/blob/master/businesslayer/feedbusinesslayer.php#L248
Test: https://github.com/owncloud/news/blob/master/tests/unit/businesslayer/FolderBusinessLayerTest.php#L182