dataInterfaceMock = $this->getMockBuilder(DataInterface::class) ->disableOriginalConstructor() ->getMock(); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->config = $this->objectManagerHelper->getObject( Config::class, [ 'data' => $this->dataInterfaceMock, ] ); } /** * @return void */ public function testGet() { $key = 'configKey'; $defaultValue = 'mock'; $configValue = 'emptyString'; $this->dataInterfaceMock ->expects($this->once()) ->method('get') ->with($key, $defaultValue) ->willReturn($configValue); $this->assertSame($configValue, $this->config->get($key, $defaultValue)); } }