Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
TranslitUrlTest.php
Go to the documentation of this file.
1 <?php
7 
8 class TranslitUrlTest extends \PHPUnit\Framework\TestCase
9 {
13  protected $model;
14 
15  protected function setUp()
16  {
17  $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
18  $this->model = $objectManager->getObject(\Magento\Framework\Filter\TranslitUrl::class);
19  }
20 
28  public function testFilter($testString, $result, $resultIconv, $isIconv)
29  {
30  if ($isIconv) {
31  $this->assertEquals($resultIconv, $this->model->filter($testString));
32  } else {
33  $this->assertEquals($result, $this->model->filter($testString));
34  }
35  }
36 
40  public function filterDataProvider()
41  {
42  $isIconv = '"libiconv"' == ICONV_IMPL;
43  return [
44  ['test', 'test', 'test', $isIconv],
45  ['привет мир', 'privet-mir', 'privet-mir', $isIconv],
46  [
47  'Weiß, Goldmann, Göbel, Weiss, Göthe, Goethe und Götz',
48  'weiss-goldmann-gobel-weiss-gothe-goethe-und-gotz',
49  'weiss-goldmann-gobel-weiss-gothe-goethe-und-gotz',
50  $isIconv
51  ],
52  [
53  '❤ ☀ ☆ ☂ ☻ ♞ ☯ ☭ ☢ € → ☎ ❄ ♫ ✂ ▷ ✇ ♎ ⇧ ☮',
54  '',
55  'eur',
56  $isIconv
57  ],
58  ['™', 'tm', 'tm', $isIconv]
59  ];
60  }
61 }
$objectManager
Definition: bootstrap.php:17
testFilter($testString, $result, $resultIconv, $isIconv)