Definition at line 28 of file LevenshteinTest.php.
◆ setUp()
ILIAS\src\Refinery\String\LevenshteinTest::setUp |
( |
| ) |
|
Definition at line 50 of file LevenshteinTest.php.
50 : void
51 {
53 $language = $this->getMockBuilder(\
ILIAS\Language\Language::class)
54 ->disableOriginalConstructor()
55 ->getMock();
57 }
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
References factory(), and ILIAS\ILIASObject\Creation\Group.
◆ testApplyToMultibyteString()
ILIAS\src\Refinery\String\LevenshteinTest::testApplyToMultibyteString |
( |
| ) |
|
Definition at line 175 of file LevenshteinTest.php.
176 {
177 $transformation = $this->group->levenshtein()->custom("bookshelf", 20, 2.0, 1.0, 1.5);
178 $value_object = $this->
factory->ok($this->test_multibyte_string);
179 $result_object = $transformation->applyTo($value_object);
180
181 $this->assertEquals(12.5, $result_object->value());
182 }
References factory().
◆ testApplyToSuccessfulCustomCost()
ILIAS\src\Refinery\String\LevenshteinTest::testApplyToSuccessfulCustomCost |
( |
| ) |
|
Definition at line 142 of file LevenshteinTest.php.
143 {
144 $transformation = $this->group->levenshtein()->custom("bookshelf", 10, 2.0, 1.0, 1.5);
145 $value_object = $this->
factory->ok(
"book");
146 $result_object = $transformation->applyTo($value_object);
147
148 $this->assertEquals(7.5, $result_object->value());
149 }
References factory().
◆ testApplyToSuccessfulDefault()
ILIAS\src\Refinery\String\LevenshteinTest::testApplyToSuccessfulDefault |
( |
| ) |
|
Definition at line 133 of file LevenshteinTest.php.
134 {
135 $transformation = $this->group->levenshtein()->standard("bookshelf", 10);
136 $value_object = $this->
factory->ok(
"book");
137 $result_object = $transformation->applyTo($value_object);
138
139 $this->assertEquals(5, $result_object->value());
140 }
References factory().
◆ testApplyToWrongType()
ILIAS\src\Refinery\String\LevenshteinTest::testApplyToWrongType |
( |
| ) |
|
Definition at line 151 of file LevenshteinTest.php.
152 {
153 $transformation = $this->group->levenshtein()->custom("bookshelf", 10, 2.0, 1.0, 1.5);
154 $value_object = $this->
factory->ok(496);
155 $result_object = $transformation->applyTo($value_object);
156
157 $this->assertTrue($result_object->isError());
158 }
References factory().
◆ testCustomCostsDeletion()
ILIAS\src\Refinery\String\LevenshteinTest::testCustomCostsDeletion |
( |
| ) |
|
Definition at line 118 of file LevenshteinTest.php.
119 {
120 $transformation = $this->group->levenshtein()->custom("bookshelf", 10, 2.0, 1.0, 1.5);
121
122 $this->assertEquals(7.5, $transformation->transform("book"));
123 }
◆ testCustomCostsInsert()
ILIAS\src\Refinery\String\LevenshteinTest::testCustomCostsInsert |
( |
| ) |
|
Definition at line 111 of file LevenshteinTest.php.
112 {
113 $transformation = $this->group->levenshtein()->custom("book", 5, 2.0, 1.0, 1.5);
114
115 $this->assertEquals(2, $transformation->transform("books"));
116 }
◆ testCustomCostsMixed()
ILIAS\src\Refinery\String\LevenshteinTest::testCustomCostsMixed |
( |
| ) |
|
Definition at line 104 of file LevenshteinTest.php.
105 {
106 $transformation = $this->group->levenshtein()->custom("back", 20, 2.0, 1.0, 1.5);
107
108 $this->assertEquals(12, $transformation->transform("bookshelf"));
109 }
◆ testCustomCostsReplacement()
ILIAS\src\Refinery\String\LevenshteinTest::testCustomCostsReplacement |
( |
| ) |
|
Definition at line 125 of file LevenshteinTest.php.
126 {
127 $transformation = $this->group->levenshtein()->custom("bookshelf", 10, 2.0, 1.0, 1.5);
128
129 $this->assertEquals(4.0, $transformation->transform("bookstore"));
130 }
◆ testEmoji()
ILIAS\src\Refinery\String\LevenshteinTest::testEmoji |
( |
| ) |
|
Definition at line 168 of file LevenshteinTest.php.
169 {
170 $transformation = $this->group->levenshtein()->custom("book", 20, 2.0, 1.0, 1.5);
171
172 $this->assertEquals(4.5, $transformation->transform($this->test_emoji));
173 }
◆ testExceedMaximumDistance()
ILIAS\src\Refinery\String\LevenshteinTest::testExceedMaximumDistance |
( |
| ) |
|
Definition at line 67 of file LevenshteinTest.php.
68 {
69 $transformation = $this->group->levenshtein()->standard("book", 1);
70
71 $this->assertEquals(-1.0, $transformation->transform("back"));
72 }
◆ testException()
ILIAS\src\Refinery\String\LevenshteinTest::testException |
( |
| ) |
|
Definition at line 88 of file LevenshteinTest.php.
89 {
90 $transformation = $this->group->levenshtein()->standard("book", 0);
91 $this->expectException(InvalidArgumentException::class);
92
93 $this->assertEquals(2.0, $transformation->transform(496));
94 }
◆ testMultibyteStringThreeByte()
ILIAS\src\Refinery\String\LevenshteinTest::testMultibyteStringThreeByte |
( |
| ) |
|
Definition at line 161 of file LevenshteinTest.php.
162 {
163 $transformation = $this->group->levenshtein()->custom($this->test_multibyte_string, 10, 2.0, 1.0, 1.5);
164
165 $this->assertEquals(0, $transformation->transform($this->test_multibyte_string));
166 }
◆ testNoMaxEscapeButOverTheLimit()
ILIAS\src\Refinery\String\LevenshteinTest::testNoMaxEscapeButOverTheLimit |
( |
| ) |
|
Definition at line 96 of file LevenshteinTest.php.
97 {
98 $transformation = $this->group->levenshtein()->standard("Juni", 2);
99
100 $this->assertEquals(-1, $transformation->transform("Januar"));
101 }
◆ testNoMaximumDistance()
ILIAS\src\Refinery\String\LevenshteinTest::testNoMaximumDistance |
( |
| ) |
|
Definition at line 81 of file LevenshteinTest.php.
82 {
83 $transformation = $this->group->levenshtein()->standard("book", 0);
84
85 $this->assertEquals(2.0, $transformation->transform("back"));
86 }
◆ testSizeReturn()
ILIAS\src\Refinery\String\LevenshteinTest::testSizeReturn |
( |
| ) |
|
Definition at line 60 of file LevenshteinTest.php.
61 {
62 $transformation = $this->group->levenshtein()->standard("book", 3);
63
64 $this->assertEquals(-1.0, $transformation->transform("bookshelf"));
65 }
◆ testSuccessfulReturn()
ILIAS\src\Refinery\String\LevenshteinTest::testSuccessfulReturn |
( |
| ) |
|
Definition at line 74 of file LevenshteinTest.php.
75 {
76 $transformation = $this->group->levenshtein()->standard("book", 1);
77
78 $this->assertEquals(0.0, $transformation->transform("book"));
79 }
◆ $factory
ILIAS\src\Refinery\String\LevenshteinTest::$factory |
|
private |
◆ $group
ILIAS\src\Refinery\String\LevenshteinTest::$group |
|
private |
◆ $test_emoji
ILIAS\src\Refinery\String\LevenshteinTest::$test_emoji = "😮💨" |
|
private |
◆ $test_multibyte_string
ILIAS\src\Refinery\String\LevenshteinTest::$test_multibyte_string = "你好" |
|
private |
The documentation for this class was generated from the following file: