PHP Classes

File: tests/FuzzySearch/BreakingValuesTest.php

Recommend this page to a friend!
  Classes of AccountKiller   Fuse   tests/FuzzySearch/BreakingValuesTest.php   Download  
File: tests/FuzzySearch/BreakingValuesTest.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Fuse
Fuzzy search of arrays using the Bitap algorithm
Author: By
Last change:
Date: 27 days ago
Size: 766 bytes
 

Contents

Class file image Download
<?php

declare(strict_types=1);

use
Fuse\Fuse;

it('processes booleans correctly', function () {
   
$fuse = new Fuse(
        [
            [
               
'first' => false,
            ],
        ],
        [
           
'keys' => [
                [
                   
'name' => 'first',
                ],
            ],
        ],
    );

   
$result = $fuse->search('fa');

   
expect($result)->toHaveCount(1);
});

it('ignores object values', function () {
   
$fuse = new Fuse(
        [
            [
               
'a' => 'hello',
            ],
            [
               
'a' => [],
            ],
        ],
        [
           
'keys' => ['a'],
        ],
    );

   
$result = $fuse->search('hello');

   
expect($result)->toHaveCount(1);
});