mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 14:33:14 +00:00
Fix Printer unit tests
This commit is contained in:
@@ -48,7 +48,7 @@ class Printer implements ControllerProviderInterface
|
|||||||
|
|
||||||
$controllers->post('/print.pdf', function(Application $app)
|
$controllers->post('/print.pdf', function(Application $app)
|
||||||
{
|
{
|
||||||
$printer = new RecordHelper\Printer($app['Core']);
|
$printer = new RecordHelper\Printer($app['Core'], $app['request']);
|
||||||
|
|
||||||
$request = $app['request'];
|
$request = $app['request'];
|
||||||
|
|
||||||
|
@@ -270,7 +270,7 @@ class PDF
|
|||||||
|
|
||||||
$y = $this->pdf->GetY();
|
$y = $this->pdf->GetY();
|
||||||
|
|
||||||
$t = phrasea::bas_names($rec->get_base_id());
|
$t = \phrasea::bas_names($rec->get_base_id());
|
||||||
$this->pdf->SetFont(PhraseaPDF::FONT, '', 10);
|
$this->pdf->SetFont(PhraseaPDF::FONT, '', 10);
|
||||||
$this->pdf->SetFillColor(220, 220, 220);
|
$this->pdf->SetFillColor(220, 220, 220);
|
||||||
$this->pdf->SetLeftMargin($lmargin);
|
$this->pdf->SetLeftMargin($lmargin);
|
||||||
|
@@ -45,8 +45,8 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
public function testRouteSlash()
|
public function testRouteSlash()
|
||||||
{
|
{
|
||||||
$records = array(
|
$records = array(
|
||||||
self::$record_1->get_serialize_key(),
|
self::$record_1->get_serialize_key(),
|
||||||
self::$record_2->get_serialize_key()
|
self::$record_2->get_serialize_key()
|
||||||
);
|
);
|
||||||
|
|
||||||
$lst = implode(';', $records);
|
$lst = implode(';', $records);
|
||||||
@@ -60,27 +60,35 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
|
|||||||
|
|
||||||
public function testRoutePrintPdf()
|
public function testRoutePrintPdf()
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->markTestSkipped("Undefined variable: k_path_url \n /Users/nicolasl/workspace/phraseanet/lib/vendor/tcpdf/config/tcpdf_config.php:75");
|
|
||||||
|
|
||||||
$records = array(
|
$records = array(
|
||||||
self::$record_1->get_serialize_key(),
|
self::$record_1->get_serialize_key(),
|
||||||
self::$record_2->get_serialize_key()
|
self::$record_2->get_serialize_key()
|
||||||
);
|
);
|
||||||
|
|
||||||
$lst = implode(';', $records);
|
$lst = implode(';', $records);
|
||||||
|
|
||||||
$crawler = $this->client->request('POST', '/printer/print.pdf', array(
|
$layouts = array(
|
||||||
'lst' => $lst,
|
\Alchemy\Phrasea\Out\Module\PDF::LAYOUT_PREVIEW,
|
||||||
'lay' => \Alchemy\Phrasea\Out\Module\PDF::LAYOUT_PREVIEW
|
\Alchemy\Phrasea\Out\Module\PDF::LAYOUT_PREVIEWCAPTION,
|
||||||
)
|
\Alchemy\Phrasea\Out\Module\PDF::LAYOUT_PREVIEWCAPTIONTDM,
|
||||||
|
\Alchemy\Phrasea\Out\Module\PDF::LAYOUT_THUMBNAILLIST,
|
||||||
|
\Alchemy\Phrasea\Out\Module\PDF::LAYOUT_THUMBNAILGRID
|
||||||
);
|
);
|
||||||
|
|
||||||
$response = $this->client->getResponse();
|
foreach ($layouts as $layout)
|
||||||
|
{
|
||||||
|
$crawler = $this->client->request('POST', '/printer/print.pdf', array(
|
||||||
|
'lst' => $lst,
|
||||||
|
'lay' => $layout
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$this->assertEquals("application/pdf", $response->headers->get("content-type"));
|
$response = $this->client->getResponse();
|
||||||
|
|
||||||
$this->assertTrue($response->isOk());
|
$this->assertEquals("application/pdf", $response->headers->get("content-type"));
|
||||||
|
|
||||||
|
$this->assertTrue($response->isOk());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user