mardi 30 juin 2015

How to use mockery to mock global class without namespace?

I would like to test my WordPress application which calls this function http://ift.tt/1JuHcSx

I'm not sure how to mock that because WPCom_Related_Posts is not namespaced.

This is how I use the class

$related_posts = WPCom_Related_Posts()->get_related_posts( get_queried_object_id(), $args );    

How should I mock this get_related_posts in the test because this class will call Elasticsearch to get related posts and I don't want to set that up in PHPUnit

Aucun commentaire:

Enregistrer un commentaire