public function setUp() { //Default command object $this->telegram = new Telegram('apikey', 'testbot'); $this->command_stub = $this->getMockForAbstractClass($this->command_namespace, [$this->telegram]); //Create separate command object that contain a command config $this->telegram_with_config = new Telegram('apikey', 'testbot'); $this->telegram_with_config->setCommandConfig('command_name', ['config_key' => 'config_value']); $this->command_stub_with_config = $this->getMockBuilder($this->command_namespace)->disableOriginalConstructor()->getMockForAbstractClass(); //Set a name for the object property so that the constructor can set the config correctly TestHelpers::setObjectProperty($this->command_stub_with_config, 'name', 'command_name'); $this->command_stub_with_config->__construct($this->telegram_with_config); }