public function PrintablePdfFormTest::testPdfFormWorks in Printer and PDF versions for Drupal 8+ 8
Same name and namespace in other branches
- 2.x src/Tests/PrintablePdfFormTest.php \Drupal\printable\Tests\PrintablePdfFormTest::testPdfFormWorks()
Tests the PDF form.
File
- src/
Tests/ PrintablePdfFormTest.php, line 40
Class
- PrintablePdfFormTest
- Tests the printable module functionality.
Namespace
Drupal\printable\TestsCode
public function testPdfFormWorks() {
$this
->drupalLogin($this->user);
$this
->drupalGet('admin/config/user-interface/printable/pdf');
$this
->assertResponse(200);
$config = $this
->config('printable.settings');
$this
->assertFieldByName('print_pdf_pdf_tool', $config
->get('printable.pdf_tool'), 'The field was found with the correct value.');
$this
->assertFieldByName('print_pdf_content_disposition', $config
->get('printable.save_pdf'), 'The field was found with the correct value.');
$this
->assertFieldByName('print_pdf_paper_size', $config
->get('printable.paper_size'), 'The field was found with the correct value.');
$this
->assertFieldByName('print_pdf_page_orientation', $config
->get('printable.page_orientation'), 'The field was found with the correct value.');
$this
->assertFieldByName('print_pdf_filename', $config
->get('printable.pdf_location'), 'The field was found with the correct value.');
$this
->drupalPostForm(NULL, [
'print_pdf_pdf_tool' => 'wkhtmltopdf',
'print_pdf_content_disposition' => 1,
'print_pdf_paper_size' => 'A10',
'print_pdf_page_orientation' => 'landscape',
'print_pdf_filename' => 'test_pdf',
], t('Submit'));
$this
->drupalGet('admin/config/user-interface/printable/pdf');
$this
->assertResponse(200);
$this
->assertFieldByName('print_pdf_pdf_tool', 'wkhtmltopdf', 'The field was found with the correct value.');
$this
->assertFieldByName('print_pdf_content_disposition', 1, 'The field was found with the correct value.');
$this
->assertFieldByName('print_pdf_paper_size', 'A10', 'The field was found with the correct value.');
$this
->assertFieldByName('print_pdf_page_orientation', 'landscape', 'The field was found with the correct value.');
$this
->assertFieldByName('print_pdf_filename', 'test_pdf', 'The field was found with the correct value.');
}