19 declare(strict_types=1);
53 $language = $this->getMockBuilder(\
ILIAS\
Language\Language::class)
54 ->disableOriginalConstructor()
62 $transformation = $this->group->levenshtein()->standard(
"book", 3);
64 $this->assertEquals(-1.0, $transformation->transform(
"bookshelf"));
69 $transformation = $this->group->levenshtein()->standard(
"book", 1);
71 $this->assertEquals(-1.0, $transformation->transform(
"back"));
76 $transformation = $this->group->levenshtein()->standard(
"book", 1);
78 $this->assertEquals(0.0, $transformation->transform(
"book"));
83 $transformation = $this->group->levenshtein()->standard(
"book", 0);
85 $this->assertEquals(2.0, $transformation->transform(
"back"));
90 $transformation = $this->group->levenshtein()->standard(
"book", 0);
91 $this->expectException(InvalidArgumentException::class);
93 $this->assertEquals(2.0, $transformation->transform(496));
98 $transformation = $this->group->levenshtein()->standard(
"Juni", 2);
100 $this->assertEquals(-1, $transformation->transform(
"Januar"));
106 $transformation = $this->group->levenshtein()->custom(
"back", 20, 2.0, 1.0, 1.5);
108 $this->assertEquals(12, $transformation->transform(
"bookshelf"));
113 $transformation = $this->group->levenshtein()->custom(
"book", 5, 2.0, 1.0, 1.5);
115 $this->assertEquals(2, $transformation->transform(
"books"));
120 $transformation = $this->group->levenshtein()->custom(
"bookshelf", 10, 2.0, 1.0, 1.5);
122 $this->assertEquals(7.5, $transformation->transform(
"book"));
127 $transformation = $this->group->levenshtein()->custom(
"bookshelf", 10, 2.0, 1.0, 1.5);
129 $this->assertEquals(4.0, $transformation->transform(
"bookstore"));
135 $transformation = $this->group->levenshtein()->standard(
"bookshelf", 10);
136 $value_object = $this->
factory->ok(
"book");
137 $result_object = $transformation->applyTo($value_object);
139 $this->assertEquals(5, $result_object->value());
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);
148 $this->assertEquals(7.5, $result_object->value());
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);
157 $this->assertTrue($result_object->isError());
163 $transformation = $this->group->levenshtein()->custom($this->test_multibyte_string, 10, 2.0, 1.0, 1.5);
165 $this->assertEquals(0, $transformation->transform($this->test_multibyte_string));
170 $transformation = $this->group->levenshtein()->custom(
"book", 20, 2.0, 1.0, 1.5);
172 $this->assertEquals(4.5, $transformation->transform($this->test_emoji));
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);
181 $this->assertEquals(12.5, $result_object->value());
testNoMaxEscapeButOverTheLimit()
Interface Observer Contains several chained tasks and infos about them.
testApplyToSuccessfulDefault()
testApplyToMultibyteString()
testExceedMaximumDistance()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testMultibyteStringThreeByte()
testCustomCostsReplacement()
testApplyToSuccessfulCustomCost()
testCustomCostsDeletion()