public function BarcodeBlockTest::testBarcodeFormat in Barcodes 2.0.x
Tests all barcode display formats.
@dataProvider providerBarcodeFormat @covers ::build
Parameters
string $format: Format to test.
string $expected: Value of barcode field.
string $expected: Barcode markup.
File
- tests/
src/ Functional/ BarcodeBlockTest.php, line 117
Class
- BarcodeBlockTest
- Tests the Barcodes module block functionality.
Namespace
Drupal\Tests\barcodes\FunctionalCode
public function testBarcodeFormat($format, $value, $expected) {
/** @var \Drupal\Tests\WebAssert $assert */
$assert = $this
->assertSession();
// Test using the CODABAR barcode type.
$this->block
->getPlugin()
->setConfigurationValue('type', 'CODABAR');
$this->block
->getPlugin()
->setConfigurationValue('format', $format);
$this->block
->getPlugin()
->setConfigurationValue('value', $value);
$this->block
->save();
$this
->drupalGet('');
$assert
->responseContains('barcode-codabar');
$assert
->responseContains($expected);
}