Fix Printer unit tests

This commit is contained in:
Romain Neutron
2012-01-26 13:53:45 +01:00
parent 3762088028
commit 006eb30d1a
3 changed files with 24 additions and 16 deletions

View File

@@ -48,7 +48,7 @@ class Printer implements ControllerProviderInterface
$controllers->post('/print.pdf', function(Application $app)
{
$printer = new RecordHelper\Printer($app['Core']);
$printer = new RecordHelper\Printer($app['Core'], $app['request']);
$request = $app['request'];

View File

@@ -270,7 +270,7 @@ class PDF
$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->SetFillColor(220, 220, 220);
$this->pdf->SetLeftMargin($lmargin);

View File

@@ -45,8 +45,8 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
public function testRouteSlash()
{
$records = array(
self::$record_1->get_serialize_key(),
self::$record_2->get_serialize_key()
self::$record_1->get_serialize_key(),
self::$record_2->get_serialize_key()
);
$lst = implode(';', $records);
@@ -60,27 +60,35 @@ class ControllerPrinterTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
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(
self::$record_1->get_serialize_key(),
self::$record_2->get_serialize_key()
self::$record_1->get_serialize_key(),
self::$record_2->get_serialize_key()
);
$lst = implode(';', $records);
$crawler = $this->client->request('POST', '/printer/print.pdf', array(
'lst' => $lst,
'lay' => \Alchemy\Phrasea\Out\Module\PDF::LAYOUT_PREVIEW
)
$layouts = array(
\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());
}
}
}