Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Dec 25, 2023
1 parent e106574 commit bb89eb9
Show file tree
Hide file tree
Showing 29 changed files with 456 additions and 98 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.3, 8.2, 8.1]
php: [8.3, 8.2]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
carbon: ^2.63

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

Expand All @@ -38,6 +37,11 @@ jobs:
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
Expand All @@ -52,4 +56,6 @@ jobs:
run: composer show -D

- name: Execute tests
run: vendor/bin/pest --ci
run:
npm install
vendor/bin/pest --ci
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ coverage
docs
phpunit.xml
phpstan.neon
node_modules/
testbench.yaml
vendor
node_modules
tests/TestSupport/temp/
public/storage
20 changes: 14 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,35 @@
],
"require": {
"php": "^8.1",
"illuminate/contracts": "^10.0",
"spatie/browsershot": "v4.x-dev",
"spatie/laravel-package-tools": "^1.14.0",
"illuminate/contracts": "^10.0"
"spatie/temporary-directory": "^2.2"
},
"require-dev": {
"larastan/larastan": "^2.0.1",
"laravel/pint": "^1.0",
"nunomaduro/collision": "^7.8",
"larastan/larastan": "^2.0.1",
"orchestra/testbench": "^8.8",
"pestphp/pest": "^2.20",
"pestphp/pest-plugin-arch": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"spatie/laravel-ray": "^1.26"
"spatie/laravel-ray": "^1.26",
"spatie/pdf-to-image": "^2.2",
"spatie/pest-plugin-snapshots": "^2.1",
"spatie/pixelmatch-php": "^1.0"
},
"autoload": {
"psr-4": {
"Spatie\\LaravelPdf\\": "src/",
"Spatie\\LaravelPdf\\Database\\Factories\\": "database/factories/"
}
},
"files": [
"src/Support/functions.php"
]
},
"autoload-dev": {
"psr-4": {
Expand Down Expand Up @@ -73,10 +81,10 @@
"extra": {
"laravel": {
"providers": [
"Spatie\\LaravelPdf\\LaravelPdfServiceProvider"
"Spatie\\LaravelPdf\\PdfServiceProvider"
],
"aliases": {
"LaravelPdf": "Spatie\\LaravelPdf\\Facades\\LaravelPdf"
"LaravelPdf": "Pdf"
}
}
},
Expand Down
19 changes: 0 additions & 19 deletions database/factories/ModelFactory.php

This file was deleted.

19 changes: 0 additions & 19 deletions database/migrations/create_pdf_table.php.stub

This file was deleted.

40 changes: 40 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"dependencies": {
"pixelmatch": "^5.3.0",
"pngjs": "^7.0.0"
}
}
Empty file removed resources/views/.gitkeep
Empty file.
9 changes: 9 additions & 0 deletions src/Enums/Orientation.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Spatie\LaravelPdf\Enums;

enum Orientation: string
{
case Portrait = 'Portrait';
case Landscape = 'Landscape';
}
18 changes: 18 additions & 0 deletions src/Enums/PaperFormat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Spatie\LaravelPdf\Enums;

enum PaperFormat: string
{
case Letter = 'letter';
case Legal = 'legal';
case Tabloid = 'tabloid';
case Ledger = 'ledger';
case A0 = 'a0';
case A1 = 'a1';
case A2 = 'a2';
case A3 = 'a3';
case A4 = 'a4';
case A5 = 'a5';
case A6 = 'a6';
}
16 changes: 0 additions & 16 deletions src/Facades/LaravelPdf.php

This file was deleted.

24 changes: 24 additions & 0 deletions src/Facades/Pdf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

namespace Spatie\LaravelPdf\Facades;

use Illuminate\Support\Facades\Facade;
use Spatie\LaravelPdf\FakePdf;

/**
* @mixin \Spatie\LaravelPdf\Pdf
*/
class Pdf extends Facade
{
protected static function getFacadeAccessor()
{
return \Spatie\LaravelPdf\Pdf::class;
}

public static function fake()
{
$fake = new FakePdf();

static::swap($fake);
}
}
15 changes: 15 additions & 0 deletions src/FakePdf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Spatie\LaravelPdf;

use PHPUnit\Framework\Assert;

class FakePdf extends Pdf
{
public function assertViewIs(string $viewName): self
{
Assert::assertEquals($viewName, $this->viewName);

return $this;
}
}
7 changes: 0 additions & 7 deletions src/LaravelPdf.php

This file was deleted.

Loading

0 comments on commit bb89eb9

Please sign in to comment.