You are here

public function StrPadTest::testStrPadLeft in Tamper 8

Test String pad Left.

@covers ::tamper

File

tests/src/Unit/Plugin/Tamper/StrPadTest.php, line 28

Class

StrPadTest
Tests the StrPad plugin.

Namespace

Drupal\Tests\tamper\Unit\Plugin\Tamper

Code

public function testStrPadLeft() {
  $config = [
    StrPad::SETTING_PAD_LENGTH => '10',
    StrPad::SETTING_PAD_STRING => ' ',
    StrPad::SETTING_PAD_TYPE => STR_PAD_LEFT,
  ];
  $plugin = new StrPad($config, 'StrPad', [], $this
    ->getMockSourceDefinition());
  $this
    ->assertEquals('        hi', $plugin
    ->tamper('hi'));
}