Writing unit tests for a method that calls static methods from another class

I have a custom service defined by my module and in one of its methods I call a static method from a class defined by a module mine depends on. Since this method is static I do not need to instantiate an object but this also means I cannot inject the dependency. Soooo... How do I mock the static call?

Here is some psuedo code to illustrate:

use some/other/class/called/FOO  ...  function myMethod() {   // Do some things...   $some_var = FOO::staticMethodToGetValue();   // Do more things...   return "something";     } 

Replay

Category: 8 Time: 2016-07-29 Views: 1
Tags: testing

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.202 (s). 12 q(s)