PHP Classes

File: tests/LevenshteinTest.php

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Similarity Between Two Strings   tests/LevenshteinTest.php   Download  
File: tests/LevenshteinTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Similarity Between Two Strings
Calculate the similarity level of two text strings
Author: By
Last change:
Date: 2 years ago
Size: 607 bytes
 

Contents

Class file image Download
<?php

namespace Anzawi\FindDiff;

use
PHPUnit\Framework\TestCase;

class
LevenshteinTest extends TestCase
{
    protected
string $firstString = "this is a test";
    protected
string $secondString = "this is test";

    public function
testGetDiff()
    {
       
$diff = Levenshtein::getDiff($this->firstString, $this->secondString);
       
$this->assertIsArray($diff);
    }

    public function
testFindDiff()
    {
       
$diff = Levenshtein::findDiff($this->firstString, $this->secondString);
       
$this->assertIsInt($diff);
       
$this->assertEquals(2, $diff);
    }
}