mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #3925 from beganovich/v2-2207-pdfmaker-changes
Moving PdfMaker out of tests folder
This commit is contained in:
commit
3f1d877273
23
app/Services/PdfMaker/Designs/Bold.php
Normal file
23
app/Services/PdfMaker/Designs/Bold.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Bold
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//bold.html')
|
||||
);
|
||||
}
|
||||
}
|
23
app/Services/PdfMaker/Designs/Business.php
Normal file
23
app/Services/PdfMaker/Designs/Business.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Business
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//business.html')
|
||||
);
|
||||
}
|
||||
}
|
23
app/Services/PdfMaker/Designs/Clean.php
Normal file
23
app/Services/PdfMaker/Designs/Clean.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Clean
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//clean.html')
|
||||
);
|
||||
}
|
||||
}
|
23
app/Services/PdfMaker/Designs/Creative.php
Normal file
23
app/Services/PdfMaker/Designs/Creative.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Creative
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//creative.html')
|
||||
);
|
||||
}
|
||||
}
|
23
app/Services/PdfMaker/Designs/Elegant.php
Normal file
23
app/Services/PdfMaker/Designs/Elegant.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Elegant
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//elegant.html')
|
||||
);
|
||||
}
|
||||
}
|
23
app/Services/PdfMaker/Designs/Hipster.php
Normal file
23
app/Services/PdfMaker/Designs/Hipster.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Hipster
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//hipster.html')
|
||||
);
|
||||
}
|
||||
}
|
23
app/Services/PdfMaker/Designs/Modern.php
Normal file
23
app/Services/PdfMaker/Designs/Modern.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Modern
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//modern.html')
|
||||
);
|
||||
}
|
||||
}
|
23
app/Services/PdfMaker/Designs/Plain.php
Normal file
23
app/Services/PdfMaker/Designs/Plain.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Plain
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//plain.html')
|
||||
);
|
||||
}
|
||||
}
|
23
app/Services/PdfMaker/Designs/Playful.php
Normal file
23
app/Services/PdfMaker/Designs/Playful.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker\Designs;
|
||||
|
||||
class Playful
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('resources/views/pdf-designs//playful.html')
|
||||
);
|
||||
}
|
||||
}
|
@ -1,6 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker;
|
||||
|
||||
class PdfMaker
|
||||
{
|
@ -1,6 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com)
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\Services\PdfMaker;
|
||||
|
||||
use DOMDocument;
|
||||
use DOMXPath;
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
class Bold
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('tests/Feature/PdfMaker/designs/bold.html')
|
||||
);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
class Business
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('tests/Feature/PdfMaker/designs/business.html')
|
||||
);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
class Clean
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('tests/Feature/PdfMaker/designs/clean.html')
|
||||
);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
class Creative
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('tests/Feature/PdfMaker/designs/creative.html')
|
||||
);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
class Elegant
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('tests/Feature/PdfMaker/designs/elegant.html')
|
||||
);
|
||||
}
|
||||
}
|
@ -2,12 +2,12 @@
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
class Modern
|
||||
class ExampleDesign
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('tests/Feature/PdfMaker/designs/modern.html')
|
||||
base_path('tests/Feature/PdfMaker/example-design.html')
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
class Hipster
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('tests/Feature/PdfMaker/designs/hipster.html')
|
||||
);
|
||||
}
|
||||
}
|
@ -2,6 +2,16 @@
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
use App\Services\PdfMaker\Designs\Bold;
|
||||
use App\Services\PdfMaker\Designs\Business;
|
||||
use App\Services\PdfMaker\Designs\Clean;
|
||||
use App\Services\PdfMaker\Designs\Creative;
|
||||
use App\Services\PdfMaker\Designs\Elegant;
|
||||
use App\Services\PdfMaker\Designs\Hipster;
|
||||
use App\Services\PdfMaker\Designs\Modern;
|
||||
use App\Services\PdfMaker\Designs\Plain;
|
||||
use App\Services\PdfMaker\Designs\Playful;
|
||||
use App\Services\PdfMaker\PdfMaker;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PdfMakerDesignsTest extends TestCase
|
||||
@ -245,8 +255,7 @@ class PdfMakerDesignsTest extends TestCase
|
||||
|
||||
info($maker->getCompiledHTML(true));
|
||||
|
||||
$this->assertTrue(true);
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testModern()
|
||||
@ -361,8 +370,7 @@ class PdfMakerDesignsTest extends TestCase
|
||||
|
||||
info($maker->getCompiledHTML(true));
|
||||
|
||||
$this->assertTrue(true);
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
|
||||
@ -478,8 +486,7 @@ class PdfMakerDesignsTest extends TestCase
|
||||
|
||||
info($maker->getCompiledHTML(true));
|
||||
|
||||
$this->assertTrue(true);
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testPlain()
|
||||
@ -586,8 +593,7 @@ class PdfMakerDesignsTest extends TestCase
|
||||
|
||||
info($maker->getCompiledHTML(true));
|
||||
|
||||
$this->assertTrue(true);
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testHipster()
|
||||
@ -698,8 +704,7 @@ class PdfMakerDesignsTest extends TestCase
|
||||
|
||||
info($maker->getCompiledHTML(true));
|
||||
|
||||
$this->assertTrue(true);
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testElegant()
|
||||
@ -814,8 +819,7 @@ class PdfMakerDesignsTest extends TestCase
|
||||
|
||||
info($maker->getCompiledHTML(true));
|
||||
|
||||
$this->assertTrue(true);
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testCreative()
|
||||
@ -930,8 +934,7 @@ class PdfMakerDesignsTest extends TestCase
|
||||
|
||||
info($maker->getCompiledHTML(true));
|
||||
|
||||
$this->assertTrue(true);
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
public function testPlayful()
|
||||
@ -1039,8 +1042,6 @@ class PdfMakerDesignsTest extends TestCase
|
||||
|
||||
info($maker->getCompiledHTML(true));
|
||||
|
||||
|
||||
$this->assertTrue(true);
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
use App\Services\PdfMaker\PdfMaker;
|
||||
use Spatie\Browsershot\Browsershot;
|
||||
use Tests\TestCase;
|
||||
|
||||
@ -12,18 +13,13 @@ class PdfMakerTest extends TestCase
|
||||
'variables' => [],
|
||||
];
|
||||
|
||||
public function setUp() :void
|
||||
{
|
||||
$this->markTestSkipped();
|
||||
}
|
||||
|
||||
public function testDesignLoadsCorrectly()
|
||||
{
|
||||
$maker = new PdfMaker($this->state);
|
||||
|
||||
$maker->design(Business::class);
|
||||
$maker->design(ExampleDesign::class);
|
||||
|
||||
$this->assertInstanceOf(Business::class, $maker->design);
|
||||
$this->assertInstanceOf(ExampleDesign::class, $maker->design);
|
||||
}
|
||||
|
||||
public function testHtmlDesignLoadsCorrectly()
|
||||
@ -31,7 +27,7 @@ class PdfMakerTest extends TestCase
|
||||
$maker = new PdfMaker($this->state);
|
||||
|
||||
$maker
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
$this->assertStringContainsString('<!-- Business -->', $maker->getCompiledHTML());
|
||||
@ -42,7 +38,7 @@ class PdfMakerTest extends TestCase
|
||||
$maker = new PdfMaker($this->state);
|
||||
|
||||
$maker
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
$this->assertEquals('table', $maker->getSectionNode('product-table')->nodeName);
|
||||
@ -73,7 +69,7 @@ class PdfMakerTest extends TestCase
|
||||
$maker = new PdfMaker($state);
|
||||
|
||||
$maker
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
$this->assertStringContainsString('my-awesome-class', $maker->getSection('product-table', 'class'));
|
||||
@ -108,7 +104,7 @@ class PdfMakerTest extends TestCase
|
||||
$maker = new PdfMaker($state);
|
||||
|
||||
$maker
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
$this->assertStringContainsString('Invoice Ninja', $maker->getCompiledHTML());
|
||||
@ -152,7 +148,7 @@ class PdfMakerTest extends TestCase
|
||||
$maker = new PdfMaker($state);
|
||||
|
||||
$maker
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
$compiled = 'contact@invoiceninja.com';
|
||||
@ -172,7 +168,7 @@ class PdfMakerTest extends TestCase
|
||||
]);
|
||||
|
||||
$maker1
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
$output1 = $maker1->getCompiledHTML();
|
||||
@ -189,7 +185,7 @@ class PdfMakerTest extends TestCase
|
||||
]);
|
||||
|
||||
$maker2
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
$output2 = $maker2->getCompiledHTML();
|
||||
@ -215,7 +211,7 @@ class PdfMakerTest extends TestCase
|
||||
]);
|
||||
|
||||
$maker
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
$node = $maker->getSectionNode('header');
|
||||
@ -242,7 +238,7 @@ class PdfMakerTest extends TestCase
|
||||
]);
|
||||
|
||||
$maker
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
$node = $maker->getSectionNode('header');
|
||||
@ -306,11 +302,9 @@ class PdfMakerTest extends TestCase
|
||||
$maker = new PdfMaker($state);
|
||||
|
||||
$maker
|
||||
->design(Business::class)
|
||||
->design(ExampleDesign::class)
|
||||
->build();
|
||||
|
||||
info($maker->getCompiledHTML());
|
||||
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
class Plain
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('tests/Feature/PdfMaker/designs/plain.html')
|
||||
);
|
||||
}
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature\PdfMaker;
|
||||
|
||||
class Playful
|
||||
{
|
||||
public function html()
|
||||
{
|
||||
return file_get_contents(
|
||||
base_path('tests/Feature/PdfMaker/designs/playful.html')
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user