Minor fixes for tests

This commit is contained in:
David Bomba 2023-05-08 14:13:14 +10:00
parent fdba7ee0de
commit 0f4113ca57

View File

@ -11,11 +11,16 @@
namespace Tests\Feature\EInvoice; namespace Tests\Feature\EInvoice;
use App\Services\Invoice\EInvoice\FacturaEInvoice;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Tests\MockAccountData;
use Tests\TestCase; use Tests\TestCase;
use Tests\MockAccountData;
use Http\Message\CookieJar;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Storage;
use App\Services\Invoice\EInvoice\FacturaEInvoice;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use function Amp\Iterator\toArray;
/** /**
* @test * @test
@ -40,10 +45,35 @@ class FacturaeTest extends TestCase
{ {
$f = new FacturaEInvoice($this->invoice, "3.2.2"); $f = new FacturaEInvoice($this->invoice, "3.2.2");
$f->run(); $path = $f->run();
$this->assertNotNull($f->run()); $this->assertNotNull($f->run());
nlog($f->run()); nlog($f->run());
// $this->assertTrue($this->validateInvoiceXML($path));
} }
// private function validateInvoiceXML($path) {
// $jar = (new \GuzzleHttp\Cookie\CookieJar())->toArray();
// echo print_r($jar);
// $response = Http::withCookies($jar, '.ninja.test')->attach(
// 'xmlFile',
// Storage::get($path),
// basename($path)
// )->post('https://viewer.facturadirecta.com/dp/viewer/upload.void'); // Instance of Guzzle/CookieJar
// echo print_r($jar);
// $response = Http::withCookies($jar, '.ninja.test')->post('https://viewer.facturadirecta.com/dp/viewer/viewer.void');
// echo print_r($response->body(), 1);
// }
} }