Fix the tests

This commit is contained in:
Narek Zakarian 2024-01-31 16:51:33 +04:00
parent 4b16638abd
commit c3ae6ad8a6
No known key found for this signature in database
GPG key ID: 07AFD7E7A9C164A7
3 changed files with 11 additions and 6 deletions

View file

@ -11,7 +11,7 @@ class AuthorizationTest extends TestCase
public function testIdAndStatus() public function testIdAndStatus()
{ {
$authorizationStatus = \Mockery::mock(AuthorizationStatus::class); $authorizationStatus = \Mockery::mock(AuthorizationStatus::class);
$testee = new Authorization('foo', $authorizationStatus); $testee = new Authorization('foo', $authorizationStatus, null);
$this->assertEquals('foo', $testee->id()); $this->assertEquals('foo', $testee->id());
$this->assertEquals($authorizationStatus, $testee->status()); $this->assertEquals($authorizationStatus, $testee->status());
@ -22,7 +22,7 @@ class AuthorizationTest extends TestCase
$authorizationStatus = \Mockery::mock(AuthorizationStatus::class); $authorizationStatus = \Mockery::mock(AuthorizationStatus::class);
$authorizationStatus->expects('name')->andReturn('CAPTURED'); $authorizationStatus->expects('name')->andReturn('CAPTURED');
$testee = new Authorization('foo', $authorizationStatus); $testee = new Authorization('foo', $authorizationStatus, null);
$expected = [ $expected = [
'id' => 'foo', 'id' => 'foo',

View file

@ -17,8 +17,9 @@ class AuthorizationFactoryTest extends TestCase
'id' => 'foo', 'id' => 'foo',
'status' => 'CAPTURED', 'status' => 'CAPTURED',
]; ];
$fraudProcessorResponseFactory = \Mockery::mock(FraudProcessorResponseFactory::class);
$testee = new AuthorizationFactory(); $testee = new AuthorizationFactory($fraudProcessorResponseFactory);
$result = $testee->from_paypal_response($response); $result = $testee->from_paypal_response($response);
$this->assertInstanceOf(Authorization::class, $result); $this->assertInstanceOf(Authorization::class, $result);
@ -36,7 +37,9 @@ class AuthorizationFactoryTest extends TestCase
'status' => 'CAPTURED', 'status' => 'CAPTURED',
]; ];
$testee = new AuthorizationFactory(); $fraudProcessorResponseFactory = \Mockery::mock(FraudProcessorResponseFactory::class);
$testee = new AuthorizationFactory($fraudProcessorResponseFactory);
$testee->from_paypal_response($response); $testee->from_paypal_response($response);
} }
@ -47,7 +50,9 @@ class AuthorizationFactoryTest extends TestCase
'id' => 'foo', 'id' => 'foo',
]; ];
$testee = new AuthorizationFactory(); $fraudProcessorResponseFactory = \Mockery::mock(FraudProcessorResponseFactory::class);
$testee = new AuthorizationFactory($fraudProcessorResponseFactory);
$testee->from_paypal_response($response); $testee->from_paypal_response($response);
} }
} }

View file

@ -251,7 +251,7 @@ class AuthorizedPaymentsProcessorTest extends TestCase
} }
private function createAuthorization(string $id, string $status): Authorization { private function createAuthorization(string $id, string $status): Authorization {
return new Authorization($id, new AuthorizationStatus($status)); return new Authorization($id, new AuthorizationStatus($status), null);
} }
private function createCapture(string $id, string $status): Capture { private function createCapture(string $id, string $status): Capture {