configMock = $this->createMock(Config::class); $this->paymentDOMock = $this->createMock(PaymentDataObjectInterface::class); $this->paymentMock = $this->createMock(Payment::class); /** @var MockObject|SubjectReader subjectReaderMock */ $this->subjectReaderMock = $this->createMock(SubjectReader::class); $this->builder = new AuthenticationDataBuilder($this->subjectReaderMock, $this->configMock); } public function testBuild() { $this->configMock->method('getLoginId') ->willReturn('myloginid'); $this->configMock->method('getTransactionKey') ->willReturn('mytransactionkey'); $expected = [ 'merchantAuthentication' => [ 'name' => 'myloginid', 'transactionKey' => 'mytransactionkey' ] ]; $buildSubject = []; $this->subjectReaderMock->method('readStoreId') ->with($buildSubject) ->willReturn(123); $this->assertEquals($expected, $this->builder->build($buildSubject)); } }