Skip to content

Commit a44d99c

Browse files
committed
TransactionTest: new expectException usage
1 parent 1beec42 commit a44d99c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

tests/Transaction/TransactionTest.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public function testSetVersion()
5151
*/
5252
public function testSetVersionException()
5353
{
54+
$this->expectException(\InvalidArgumentException::class);
55+
$this->expectExceptionMessage("Transaction version is outside valid range");
56+
5457
new Transaction(4294967999);
5558
}
5659

@@ -69,29 +72,23 @@ public function testSetLockTime()
6972
$this->assertEquals($lockTime, $tx->getLockTime());
7073
}
7174

72-
/**
73-
* @expectedException \Exception
74-
*/
7575
public function testSetLockTimeException()
7676
{
77+
$this->expectException(\InvalidArgumentException::class);
7778
new Transaction(1, [], [], [], 4294967297);
7879
}
7980

80-
/**
81-
* @expectedException \Exception
82-
*/
8381
public function testGetInputException()
8482
{
8583
$tx = new Transaction();
84+
$this->expectException(\RuntimeException::class);
8685
$tx->getInput(0);
8786
}
8887

89-
/**
90-
* @expectedException \Exception
91-
*/
9288
public function testGetOutputException()
9389
{
9490
$tx = new Transaction();
91+
$this->expectException(\RuntimeException::class);
9592
$tx->getOutput(0);
9693
}
9794

0 commit comments

Comments
 (0)