3 declare(strict_types=1);
54 $language = $this->getMockBuilder(ilLanguage::class)
55 ->disableOriginalConstructor()
57 $this->group =
new Group($this->factory, $language);
63 $transformation = $this->group->levenshtein()->standard(
"book", 3);
65 $this->assertEquals(-1.0, $transformation->transform(
"bookshelf"));
70 $transformation = $this->group->levenshtein()->standard(
"book", 1);
72 $this->assertEquals(-1.0, $transformation->transform(
"back"));
77 $transformation = $this->group->levenshtein()->standard(
"book", 1);
79 $this->assertEquals(0.0, $transformation->transform(
"book"));
84 $transformation = $this->group->levenshtein()->standard(
"book", 0);
86 $this->assertEquals(2.0, $transformation->transform(
"back"));
91 $transformation = $this->group->levenshtein()->standard(
"book", 0);
92 $this->expectException(InvalidArgumentException::class);
94 $this->assertEquals(2.0, $transformation->transform(496));
99 $transformation = $this->group->levenshtein()->standard(
"Juni", 2);
101 $this->assertEquals(-1, $transformation->transform(
"Januar"));
107 $transformation = $this->group->levenshtein()->custom(
"back", 20, 2.0, 1.0, 1.5);
109 $this->assertEquals(12, $transformation->transform(
"bookshelf"));
114 $transformation = $this->group->levenshtein()->custom(
"book", 5, 2.0, 1.0, 1.5);
116 $this->assertEquals(2, $transformation->transform(
"books"));
121 $transformation = $this->group->levenshtein()->custom(
"bookshelf", 10, 2.0, 1.0, 1.5);
123 $this->assertEquals(7.5, $transformation->transform(
"book"));
128 $transformation = $this->group->levenshtein()->custom(
"bookshelf", 10, 2.0, 1.0, 1.5);
130 $this->assertEquals(4.0, $transformation->transform(
"bookstore"));
136 $transformation = $this->group->levenshtein()->standard(
"bookshelf", 10);
137 $value_object = $this->factory->ok(
"book");
138 $result_object = $transformation->applyTo($value_object);
140 $this->assertEquals(5, $result_object->value());
145 $transformation = $this->group->levenshtein()->custom(
"bookshelf", 10, 2.0, 1.0, 1.5);
146 $value_object = $this->factory->ok(
"book");
147 $result_object = $transformation->applyTo($value_object);
149 $this->assertEquals(7.5, $result_object->value());
154 $transformation = $this->group->levenshtein()->custom(
"bookshelf", 10, 2.0, 1.0, 1.5);
155 $value_object = $this->factory->ok(496);
156 $result_object = $transformation->applyTo($value_object);
158 $this->assertTrue($result_object->isError());
164 $transformation = $this->group->levenshtein()->custom($this->test_multibyte_string, 10, 2.0, 1.0, 1.5);
166 $this->assertEquals(0, $transformation->transform($this->test_multibyte_string));
171 $transformation = $this->group->levenshtein()->custom(
"book", 20, 2.0, 1.0, 1.5);
173 $this->assertEquals(4.5, $transformation->transform($this->test_emoji));
178 $transformation = $this->group->levenshtein()->custom(
"bookshelf", 20, 2.0, 1.0, 1.5);
179 $value_object = $this->factory->ok($this->test_multibyte_string);
180 $result_object = $transformation->applyTo($value_object);
182 $this->assertEquals(12.5, $result_object->value());
testNoMaxEscapeButOverTheLimit()
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
testApplyToSuccessfulDefault()
testApplyToMultibyteString()
testExceedMaximumDistance()
testMultibyteStringThreeByte()
testCustomCostsReplacement()
testApplyToSuccessfulCustomCost()
testCustomCostsDeletion()