eZ Platform Discussions

Unit testing controller


#1

Hi,

I want to unit test my controllers with phpunit. (Not integration test, but unit tests). Is there some example on how to inject mock repositories and services ?

Thanks!


#2

Hi! This one, maybe? https://github.com/ezsystems/ezpublish-kernel/blob/a1045266514a6984e9d05ec8547d2214e1d73410/eZ/Publish/Core/MVC/Symfony/Controller/Tests/Controller/Content/PreviewControllerTest.php