StateToAbbrevTest.php in Tamper 8
File
tests/src/Unit/Plugin/Tamper/StateToAbbrevTest.php
View source
<?php
namespace Drupal\Tests\tamper\Unit\Plugin\Tamper;
use Drupal\tamper\Plugin\Tamper\StateToAbbrev;
class StateToAbbrevTest extends TamperPluginTestBase {
protected function instantiatePlugin() {
return new StateToAbbrev([], 'state_to_abbrev', [], $this
->getMockSourceDefinition());
}
public function testLowerCaseCalifornia() {
$this
->assertEquals('CA', $this->plugin
->tamper('california'));
}
public function testExistingStateCode() {
$this
->assertEquals('MA', $this->plugin
->tamper('massachusetts'));
}
public function testUpperCaseHawaii() {
$this
->assertEquals('HI', $this->plugin
->tamper('HAWAII'));
}
public function testMixedCaseMassachusetts() {
$this
->assertEquals('MA', $this->plugin
->tamper('MaSsAcHuSeTtS'));
}
public function testNorthernMarianaIslands() {
$this
->assertEquals('MP', $this->plugin
->tamper('Northern Mariana Islands'));
}
public function testStateNotFound() {
$this
->assertEquals('', $this->plugin
->tamper('xyz'));
}
}