createMock(Context::class); $this->configMock = $this->createMock(ConfigProvider::class); $this->block = new Payment($contextMock, $this->configMock, new Json()); } public function testConfigIsCreated() { $this->configMock->method('getConfig') ->willReturn([ 'payment' => [ 'authorizenet_acceptjs' => [ 'foo' => 'bar' ] ] ]); $result = $this->block->getPaymentConfig(); $expected = '{"foo":"bar","code":"authorizenet_acceptjs"}'; $this->assertEquals($expected, $result); } }