{
public function testFormat()
{
- $this->assertEquals(48, strlen(new Horde_Support_Guid()));
- $this->assertRegExp('/\d{14}\.[-_0-9a-zA-Z]{23}@localhost/', (string)new Horde_Support_Guid());
+ $length = strlen(new Horde_Support_Guid());
+ $this->assertLessThanOrEqual(48, $length);
+ $this->assertGreaterThanOrEqual(47, $length);
+ $this->assertRegExp('/\d{14}\.[-_0-9a-zA-Z]{22,23}@localhost/', (string)new Horde_Support_Guid());
}
public function testDuplicates()
public function testOptions()
{
$this->assertStringEndsWith('example.com', (string)new Horde_Support_Guid(array('server' => 'example.com')));
- $this->assertRegExp('/\d{14}\.prefix\.[-_0-9a-zA-Z]{23}@localhost/', (string)new Horde_Support_Guid(array('prefix' => 'prefix')));
+ $this->assertRegExp('/\d{14}\.prefix\.[-_0-9a-zA-Z]{22,23}@localhost/', (string)new Horde_Support_Guid(array('prefix' => 'prefix')));
}
}
{
public function testLength()
{
- $this->assertEquals(23, strlen(new Horde_Support_Randomid()));
+ $length = strlen(new Horde_Support_Randomid());
+ $this->assertLessThanOrEqual(23, $length);
+ $this->assertGreaterThanOrEqual(22, $length);
}
public function testDuplicates()