Skip to content

Commit

Permalink
cover more code
Browse files Browse the repository at this point in the history
  • Loading branch information
RikudouSage committed Sep 27, 2021
1 parent 228453a commit abed5c2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
10 changes: 10 additions & 0 deletions src/QrPayment.php
Expand Up @@ -435,6 +435,16 @@ public function setPayeeAddressLine2(string $addressLine): QrPayment
return $this;
}

public function getPayeeAddressLine1(): string
{
return $this->payeeAddressLine1;
}

public function getPayeeAddressLine2(): string
{
return $this->payeeAddressLine2;
}

public function getXzBinaryLocator(): XzBinaryLocatorInterface
{
return $this->xzBinaryLocator;
Expand Down
20 changes: 16 additions & 4 deletions tests/QrPaymentTest.php
Expand Up @@ -6,13 +6,16 @@
use DateTimeInterface;
use Endroid\QrCode\QrCode;
use InvalidArgumentException;
use Rikudou\BySquare\Decoder\PayBySquareDecoder;
use Rikudou\BySquare\VO\DecodedBySquareData;
use Rikudou\Iban\Iban\IBAN;
use rikudou\SkQrPayment\Exception\InvalidTypeException;
use rikudou\SkQrPayment\Exception\QrPaymentException;
use rikudou\SkQrPayment\Payment\QrPaymentOptions;
use rikudou\SkQrPayment\QrPayment;
use PHPUnit\Framework\TestCase;
use rikudou\SkQrPayment\Xz\XzBinaryLocator;
use stdClass;
use TypeError;

class QrPaymentTest extends TestCase
Expand Down Expand Up @@ -92,7 +95,7 @@ public function testSetOptions()
// test that values from array are type checked
$this->expectException(TypeError::class);
$this->instance->setOptions([
QrPaymentOptions::VARIABLE_SYMBOL => new \stdClass(),
QrPaymentOptions::VARIABLE_SYMBOL => new stdClass(),
]);
}

Expand Down Expand Up @@ -226,7 +229,7 @@ public function __toString()
self::assertSame('123', $this->instance->getVariableSymbol());

$this->expectException(TypeError::class);
$this->instance->setVariableSymbol(new \stdClass());
$this->instance->setVariableSymbol(new stdClass());
}

public function testSetSpecificSymbol()
Expand All @@ -247,7 +250,7 @@ public function __toString()
self::assertSame('123', $this->instance->getSpecificSymbol());

$this->expectException(TypeError::class);
$this->instance->setSpecificSymbol(new \stdClass());
$this->instance->setSpecificSymbol(new stdClass());
}

public function testSetConstantSymbol()
Expand All @@ -268,6 +271,15 @@ public function __toString()
self::assertSame('123', $this->instance->getConstantSymbol());

$this->expectException(TypeError::class);
$this->instance->setConstantSymbol(new \stdClass());
$this->instance->setConstantSymbol(new stdClass());
}

public function testSetPayeeAddressLine()
{
$this->instance->setPayeeAddressLine1('123');
$this->instance->setPayeeAddressLine2('456');

self::assertEquals('123', $this->instance->getPayeeAddressLine1());
self::assertEquals('456', $this->instance->getPayeeAddressLine2());
}
}

0 comments on commit abed5c2

Please sign in to comment.