Subiendo proyecto completo sin restricciones de git ignore

This commit is contained in:
Jose Sanchez
2023-08-17 11:44:02 -04:00
parent a0d4f5ba3b
commit 20f1c60600
19921 changed files with 2509159 additions and 45 deletions

View File

@@ -0,0 +1,51 @@
<?php
namespace niklasravnsborg\LaravelPdf\Test;
use PDF;
use Imagick;
class PdfTest extends TestCase
{
public function testSimplePdfIsCorrect()
{
$pdf = PDF::loadHTML('<p>This gets tested!</p>');
$this->compareToSnapshot('simple', $pdf->output());
}
public function testExposifyPdfExposeIsCorrect()
{
$pdf = PDF::loadFile('tests/views/exposify-expose.html');
$this->compareToSnapshot('exposify', $pdf->output());
}
protected function compareToSnapshot($snapshotId, $data)
{
$snapshotFile = "tests/snapshots/{$snapshotId}.pdf";
// create snapshot if it doesn't exist
if (!file_exists($snapshotFile)) {
file_put_contents($snapshotFile, $data);
return;
}
$snapshot = file_get_contents($snapshotFile);
$this->assertPdfsLookTheSame($snapshot, $data);
}
public function assertPdfsLookTheSame($pdf1, $pdf2, $message = '')
{
$assertedImagick = new Imagick();
$assertedImagick->readImageBlob($pdf1);
$assertedImagick->resetIterator();
$assertedImagick = $assertedImagick->appendImages(true);
$testImagick = new Imagick();
$testImagick->readImageBlob($pdf2);
$testImagick->resetIterator();
$testImagick = $testImagick->appendImages(true);
$diff = $assertedImagick->compareImages($testImagick, 1);
$pdfsLookTheSame = 0.0 == $diff[1];
self::assertTrue($pdfsLookTheSame, 'Failed asserting that PDFs look the same.');
}
}

View File

@@ -0,0 +1,31 @@
<?php
namespace niklasravnsborg\LaravelPdf\Test;
use niklasravnsborg\LaravelPdf\Facades\Pdf;
use niklasravnsborg\LaravelPdf\PdfServiceProvider;
use Orchestra\Testbench\TestCase as OrchestraTestCase;
class TestCase extends OrchestraTestCase {
/**
* Load package service provider
* @param \Illuminate\Foundation\Application $app
* @return lasselehtinen\MyPackage\MyPackageServiceProvider
*/
protected function getPackageProviders($app)
{
return [PdfServiceProvider::class];
}
/**
* Load package alias
* @param \Illuminate\Foundation\Application $app
* @return array
*/
protected function getPackageAliases($app)
{
return [
'PDF' => Pdf::class,
];
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,245 @@
<!DOCTYPE html>
<html>
<head>
<title>Parkstraße</title>
<style>
@page {
footer: page-footer;
margin: 0;
margin-top: 35pt;
margin-bottom: 50pt;
margin-footer: 18pt;
}
@page :first {
margin-top: 0;
}
body {
margin: 0;
font-family: sans-serif;
font-size: 12pt;
}
table, tr, td {
padding: 0;
border-collapse: collapse;
}
table { width: 100%; }
td { vertical-align: top; }
.page-break-before { page-break-before: always; }
.container { padding: 0 35pt; }
main .container {
margin-top: 2em;
}
main h2 {
margin: 0 0 .8em;
page-break-after: avoid;
}
main p, main .table-wrapper {
margin: 0 0 1em;
}
.clearfix {
clear: both;
}
.text-center { text-align: center; }
.vertical-bar {
display: block;
width: 100px;
border-bottom: 1px solid #ccc;
margin: 0 auto;
}
.col1 { width: 8.33333%; }
.col2 { width: 16.66667%; }
.col3 { width: 25%; }
.col4 { width: 33.33333%; }
.col5 { width: 41.66667%; }
.col6 { width: 50%; }
.col7 { width: 58.33333%; }
.col8 { width: 66.66667%; }
.col9 { width: 75%; }
.col10 { width: 83.33333%; }
.col11 { width: 91.66667%; }
.col12 { width: 100%; }
#header {
border: none;
padding: 30pt 0;
background-color: #3456D8;
}
#header table {
color: #FFFFFF;
}
.grid-images {
margin: -1%;
}
.tile-image {
float: left;
padding: 1%;
}
.tile-image img {
display: block;
width: 100%;
}
.details-column-table {
margin: 0 15pt;
table-layout: fixed;
}
.details-column-table tr {
border: none;
border-bottom: .5pt solid #ddd;
}
.details-column-table tr:last-child {
border: none;
}
.details-column-table td {
line-height: 30pt;
}
.details-column-table .label {
font-weight: bold;
}
.details-column-table .value {
text-align: right;
white-space: nowrap;
font-weight: normal;
}
.tag {
float: left;
width: auto;
margin: 0 .5em .5em;
padding: .3em .5em;
background-color: #eee;
border-radius: 3px;
text-align: center;
}
.contact-box {
width: 350pt;
margin: 35pt auto;
padding: 30pt;
border-radius: 2pt;
border: 1pt solid rgba(0, 0, 0, .1);
border-bottom-width: 3pt;
page-break-inside: avoid;
}
.contact-image {
margin: 0 auto;
width: 30%;
padding-bottom: 30%;
border-radius: 50%;
background-size: 100% auto;
background-position: center;
background-image: url(https://dummyimage.com/150x150);
}
.contact-details {
margin: 0 auto;
width: 70%;
text-align: center;
}
.contact-name {
margin-top: 18pt;
margin-bottom: 0;
font-size: 1.5em;
}
.contact-email {
color: #aaa;
}
.contact-phone {
margin-top: 15pt;
}
</style>
</head>
<body>
<header id="header">
<div class="container">
<div class="table-wrapper">
<table>
<tr>
<td class="col9">
<h1 style="font-size: 1.6em; margin-bottom: 10pt;">Parkstraße</h1>
<div style="margin-top: 30pt;">
Test
</div>
</td>
<td class="col3" style="text-align: right; vertical-align: middle;"><img alt="Test Team" src="https://dummyimage.com/600x400/3456D8" style="height: 70px;"></td>
</tr>
</table>
</div>
</div>
</header>
<main>
<div class="container">
<div class="grid-images">
<div class="tile-image" style="width: 98%;"><img src="https://dummyimage.com/400x200"></div>
<div class="clearfix"></div>
</div>
</div>
<div class="container">
<h2>Details</h2>
<table style="margin: 0 -15pt;">
<tr>
<td class="col6">
<table class="details-column-table">
<tr>
<td class="label">Typ:</td>
<td class="value">Wohnung zur Miete</td>
</tr>
</table>
</td>
<td class="col6">
<table class="details-column-table">
<tr>
<td class="label">Nummer:</td>
<td class="value">#5865</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<div class="container">
<div class="tags">
<div class="clearfix"></div>
</div>
</div>
<div class="page-break-before"></div>
<div class="container">
<div class="contact-box">
<div class="contact-image"></div>
<div class="contact-details">
<h3 class="contact-name">Niklas</h3>
<div class="contact-email">
test@gmail.com
</div>
<div class="contact-phone">
1234
</div>
</div>
</div>
</div>
</main>
</body>
</html>