You are here

public function PrintableFormTest::testPrintFormWorks in Printer and PDF versions for Drupal 8+ 8

Same name and namespace in other branches
  1. 2.x src/Tests/PrintableFormTest.php \Drupal\printable\Tests\PrintableFormTest::testPrintFormWorks()

Tests the Print form.

File

src/Tests/PrintableFormTest.php, line 40

Class

PrintableFormTest
Tests the printable module functionality.

Namespace

Drupal\printable\Tests

Code

public function testPrintFormWorks() {
  $this
    ->drupalLogin($this->user);
  $this
    ->drupalGet('admin/config/user-interface/printable/print');
  $this
    ->assertResponse(200);
  $config = $this
    ->config('printable.settings');
  $this
    ->assertFieldByName('print_html_sendtoprinter', $config
    ->get('printable.send_to_printer'), 'The field was found with the correct value.');
  $this
    ->drupalPostForm(NULL, [
    'print_html_sendtoprinter' => 1,
  ], t('Submit'));
  $this
    ->drupalGet('admin/config/user-interface/printable/print');
  $this
    ->assertResponse(200);
  $this
    ->assertFieldByName('print_html_sendtoprinter', 1, 'The field was found with the correct value.');
}