Skip to content

Commit b554a35

Browse files
committed
Merge remote-tracking branch 'origin/main' into optim-blocklist
2 parents 67d951e + a818ed4 commit b554a35

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/SqidsBlocklistTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,28 @@ public function testMaxEncodingAttempts()
106106
$this->expectException(InvalidArgumentException::class);
107107
$sqids->encode([0]);
108108
}
109+
110+
public function testSpecificIsBlockedIdScenarios()
111+
{
112+
$sqids = new Sqids('', 0, ['hey']);
113+
$this->assertSame('86u', $sqids->encode([100]));
114+
115+
$sqids = new Sqids('', 0, ['86u']);
116+
$this->assertSame('sec', $sqids->encode([100]));
117+
118+
$sqids = new Sqids('', 0, ['vFo']);
119+
$this->assertSame('gMvFo', $sqids->encode([1000000]));
120+
121+
$sqids = new Sqids('', 0, ['lP3i']);
122+
$this->assertSame('oDqljxrokxRt', $sqids->encode([100, 202, 303, 404]));
123+
124+
$sqids = new Sqids('', 0, ['1HkYs']);
125+
$this->assertSame('oDqljxrokxRt', $sqids->encode([100, 202, 303, 404]));
126+
127+
$sqids = new Sqids('', 0, ['0hfxX']);
128+
$this->assertSame('862REt0hfxXVdsLG8vGWD', $sqids->encode([101, 202, 303, 404, 505, 606, 707]));
129+
130+
$sqids = new Sqids('', 0, ['hfxX']);
131+
$this->assertSame('seu8n1jO9C4KQQDxdOxsK', $sqids->encode([101, 202, 303, 404, 505, 606, 707]));
132+
}
109133
}

0 commit comments

Comments
 (0)