Background
I have two classes, A and B, where A is a class which is full of static methods (Behat/Mink step definitions), but using logic methods from an instance of class B.
What I want is to have class A be able to use methods from an instance of B, A will have no constructor.
class A {
// This class needs an instance of B, but A has no constructor
const B_INSTANCE = new B(); //Surely not?
}
class B {
public function __construct() {}
public function methodForUseInClassA() {...}
}
Nuance
Right now, I have A extending B, but for unit testing purposes, instantiating B would be a better solution.
Question
How can I facilitate this? Is there some accepted best practice for this?
Any tips appreciated!