dict = new StringCompare( [ 'Table Airplane Snowflake', 'Football Pancake Doghouse Bathtub', 'Spaceship Cowboy Spaceship Cowboy', 'Snowflake Bathtub Snowflake Toothbrush Sidewalk', 'Rocket Spaceship Table', 'Cowboy Snowflake Bathtub', 'Spaceship Classroom Apple', 'Bathtub Sidewalk Table', 'Teacher Bathtub Paper', 'Cartoon', 'Cowboy Table Pencil Candy Snowflake', 'Apple Apple Cowboy Rocket', 'Sidewalk Tiger Snowflake Spider', 'Zebra Apple Magnet Sidewal', ] ); } /** * @testdox A string can be matched with a dictionary entry * @covers phpOMS\Utils\StringCompare * @group framework */ public function testDictionaryMatch() : void { self::assertEquals('Cartoon', $this->dict->matchDictionary('Carton')); self::assertEquals('Bathtub Sidewalk Table', $this->dict->matchDictionary('Sidewalk Table')); } /** * @testdox A string doesn't match a dictionary entry if it is very different * @covers phpOMS\Utils\StringCompare * @group framework */ public function testInvalidDictionary() : void { self::assertNotEquals('Snowflake Bathtub Snowflake Toothbrush Sidewalk', $this->dict->matchDictionary('Toothbrush')); } /** * @testdox A new dictionary entry can be created and returned * @covers phpOMS\Utils\StringCompare * @group framework */ public function testDictionaryAdd() : void { $this->dict->add('Carton'); self::assertEquals('Carton', $this->dict->matchDictionary('carton')); } }