forked from Cavemanon/cavepaintings
count less
This commit is contained in:
@ -116,15 +116,10 @@ class Tag
|
||||
|
||||
$tags1 = array_map("strtolower", $tags1);
|
||||
$tags2 = array_map("strtolower", $tags2);
|
||||
natcasesort($tags1);
|
||||
natcasesort($tags2);
|
||||
sort($tags1);
|
||||
sort($tags2);
|
||||
|
||||
for ($i = 0; $i < count($tags1); $i++) {
|
||||
if ($tags1[$i]!==$tags2[$i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return $tags1 == $tags2;
|
||||
}
|
||||
|
||||
public static function get_diff_tags(array $source, array $remove): array
|
||||
|
@ -23,4 +23,13 @@ class TagTest extends TestCase
|
||||
$this->assertEquals("foo^q", Tag::caret("foo?"));
|
||||
$this->assertEquals("a^^b^sc^bd^qe^af", Tag::caret("a^b/c\\d?e&f"));
|
||||
}
|
||||
|
||||
public function test_compare()
|
||||
{
|
||||
$this->assertFalse(Tag::compare(["foo"], ["bar"]));
|
||||
$this->assertFalse(Tag::compare(["foo"], ["foo", "bar"]));
|
||||
$this->assertTrue(Tag::compare([], []));
|
||||
$this->assertTrue(Tag::compare(["foo"], ["FoO"]));
|
||||
$this->assertTrue(Tag::compare(["foo", "bar"], ["bar", "FoO"]));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user