* Added Missing Invoice Getter Methods * Fixed getId Method Array Key * PreciseNumber to getAmount on invoices * Return parseString method on getAmount() * Updated Signature Key, Exception Condition * Lightning Internal Node Updates & Tests * cs-fix * skipping all tests since they are live * Bumped php version * Removed Null safe returns * removed credentials * fix psalm * php CurlHandle * Removed null safe from status enum * dotenv for testing * protected properties * all .env in setup * Create Invoice within a Test, Throw if variables aren't set * Cleaned up Setup * cs fix * Cleaned up isset env vars * fixed phpunit indent
48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace BTCPayServer\Tests;
|
|
|
|
use Dotenv\Dotenv;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class BaseTest extends TestCase
|
|
{
|
|
protected string $host;
|
|
protected string $apiKey;
|
|
protected string $nodeUri;
|
|
protected string $storeId;
|
|
|
|
public static function setUpBeforeClass(): void
|
|
{
|
|
$dotenv = Dotenv::createImmutable(__DIR__);
|
|
$dotenv->safeLoad();
|
|
|
|
if (!isset($_ENV['BTCPAY_API_KEY'], $_ENV['BTCPAY_HOST'], $_ENV['BTCPAY_STORE_ID'], $_ENV['BTCPAY_NODE_URI'])) {
|
|
throw new \Exception('Missing .env variables');
|
|
}
|
|
}
|
|
|
|
protected function setUp(): void
|
|
{
|
|
$this->host = $_ENV['BTCPAY_HOST'];
|
|
$this->apiKey = $_ENV['BTCPAY_API_KEY'];
|
|
$this->nodeUri = $_ENV['BTCPAY_NODE_URI'];
|
|
$this->storeId = $_ENV['BTCPAY_STORE_ID'];
|
|
}
|
|
|
|
public function testThatAllTheVariablesAreSet(): void
|
|
{
|
|
$this->assertIsString($this->apiKey);
|
|
$this->assertIsString($this->host);
|
|
$this->assertIsString($this->storeId);
|
|
$this->assertIsString($this->nodeUri);
|
|
|
|
$this->assertNotEmpty($this->apiKey);
|
|
$this->assertNotEmpty($this->host);
|
|
$this->assertNotEmpty($this->storeId);
|
|
$this->assertNotEmpty($this->nodeUri);
|
|
}
|
|
}
|