84 lines
2.4 KiB
PHP
84 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Tests\Service\Pdf;
|
|
|
|
use App\Entity\Application;
|
|
use App\Entity\Assignment;
|
|
use App\Entity\Destination;
|
|
use App\Entity\Disposition;
|
|
use App\Entity\Embeddable\Address;
|
|
use App\Entity\Embeddable\Communication;
|
|
use App\Entity\JobProfile;
|
|
use App\Entity\Teamer;
|
|
use App\Entity\User;
|
|
use App\Service\Pdf\ContractRenderer;
|
|
use App\Service\Pdf\Pdf;
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
use Symfony\Contracts\Translation\TranslatorInterface;
|
|
|
|
class ContractRendererTest extends WebTestCase
|
|
{
|
|
public function testRendersContract(): void
|
|
{
|
|
$projectDir = static::getContainer()->getParameter('kernel.project_dir');
|
|
/** @var TranslatorInterface $translator */
|
|
$translator = static::getContainer()->get(TranslatorInterface::class);
|
|
$renderer = new ContractRenderer($translator, ['project_dir' => $projectDir]);
|
|
|
|
$address = new Address();
|
|
$address
|
|
->setStreet('Testweg 1')
|
|
->setCity('Teststadt')
|
|
->setPostCode('12345')
|
|
;
|
|
|
|
$communication = new Communication();
|
|
$communication
|
|
->setEmail('[email protected]')
|
|
->setPhone('123456789')
|
|
->setMobile('0123-456789')
|
|
;
|
|
|
|
$teamer = new Teamer();
|
|
$teamer
|
|
->setFirstName('Isolde')
|
|
->setLastName('Duschen')
|
|
->setAddress($address)
|
|
;
|
|
|
|
$destination = new Destination();
|
|
$destination
|
|
->setProduct('Skireise')
|
|
->setHotel('Unterkunft')
|
|
->setCode('ABC123')
|
|
->setDateFrom(new \DateTimeImmutable('2023-12-01'))
|
|
->setDateTo(new \DateTimeImmutable('2023-12-08'))
|
|
;
|
|
|
|
$jobProfile = new JobProfile();
|
|
$jobProfile->setName('Allrounder');
|
|
|
|
$contact = new User();
|
|
$contact
|
|
->setFirstName('Carmen')
|
|
->setLastName('Bär')
|
|
->setEmail('[email protected]')
|
|
;
|
|
|
|
$assignment = new Assignment();
|
|
$assignment
|
|
->setDestination($destination)
|
|
->setJobProfile($jobProfile)
|
|
->setContact($contact)
|
|
;
|
|
|
|
$application = new Application($assignment, $teamer);
|
|
$disposition = new Disposition($application);
|
|
|
|
$pdf = $renderer->render($disposition);
|
|
$this->assertInstanceOf(Pdf::class, $pdf);
|
|
|
|
$pdf->Output('F', $projectDir.'/temp/Honorarvertrag.pdf');
|
|
}
|
|
}
|