From 0f4113ca5761a469eae5872fb91104b48b9672ea Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 8 May 2023 14:13:14 +1000 Subject: [PATCH] Minor fixes for tests --- tests/Feature/EInvoice/FacturaeTest.php | 40 +++++++++++++++++++++---- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/tests/Feature/EInvoice/FacturaeTest.php b/tests/Feature/EInvoice/FacturaeTest.php index 3085d4221b18..77da9477a011 100644 --- a/tests/Feature/EInvoice/FacturaeTest.php +++ b/tests/Feature/EInvoice/FacturaeTest.php @@ -11,11 +11,16 @@ 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\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 @@ -40,10 +45,35 @@ class FacturaeTest extends TestCase { $f = new FacturaEInvoice($this->invoice, "3.2.2"); - $f->run(); + $path = $f->run(); $this->assertNotNull($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); + +// } + } \ No newline at end of file