Skip to content

Commit

Permalink
test: refactor it throws type error on null assignments test
Browse files Browse the repository at this point in the history
  • Loading branch information
gasspper committed Jul 3, 2024
1 parent e3a51df commit 8f0c32e
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions tests/Webpay/WebpayPlus/WebpayPlusTransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,14 +235,9 @@ public function it_throws_type_error_on_null_assignments()
->willReturn([]);

$transaction = new Transaction($this->optionsMock, $this->requestServiceMock);
$errorCaught = false;
try {
$transaction->commit($tokenMock);
} catch (\TypeError $e) {
$this->assertStringContainsString('Cannot assign null to property', $e->getMessage());
$errorCaught = true;
}
$this->assertTrue($errorCaught, "Expected TypeError was not caught");
$this->expectException(\TypeError::class);
$this->expectExceptionMessage('Argument #1 ($json) must be of type array');
$transaction->commit($tokenMock);
}

/** @test */
Expand Down

0 comments on commit 8f0c32e

Please sign in to comment.