File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -388,6 +388,9 @@ public function validate()
388388 if ($ props ['units ' ] < 0 ) {
389389 throw new ValidationException ('Items units can \'t be a negative number ' );
390390 }
391+ if ($ props ['vatPercentage ' ] === null ) {
392+ throw new ValidationException ('Item vatPercentage is empty ' );
393+ }
391394 if ($ props ['vatPercentage ' ] < 0 ) {
392395 throw new ValidationException ('Items vatPercentage can \'t be a negative number ' );
393396 }
Original file line number Diff line number Diff line change @@ -57,6 +57,17 @@ public function testItemWithNegativeUnitsThrowsError()
5757 ->validate ();
5858 }
5959
60+ public function testItemWithoutVatThrowsError ()
61+ {
62+ $ this ->expectException (ValidationException::class);
63+ (new Item ())->setUnitPrice (1 )
64+ ->setUnits (2 )
65+ ->setStamp ('thisIsStamp ' )
66+ ->setProductCode ('productCode123 ' )
67+ ->setDescription ('description ' )
68+ ->validate ();
69+ }
70+
6071 public function testItemWIthNegativeVatThrowsError ()
6172 {
6273 $ this ->expectException (ValidationException::class);
You can’t perform that action at this time.
0 commit comments