feat: ensure passed tags are strings
Newer versions of PHP raise a warning if you attempt to use array syntax against non-strings / non-arrays. Added sanity check to ensure we're working with a string, otherwise skip it. Also added in PHP 8.1 to the testing suite and bumped the copyright. Bumped version to 2.0 since as the change in expected output is a breaking change.
This commit is contained in:
parent
ae53465dad
commit
c9e2957c23
5 changed files with 23 additions and 10 deletions
|
@ -183,5 +183,16 @@ class LoremIpsumTest extends TestCase
|
|||
$this->$assertRegExp('/^<li>[a-z]+<\/li>$/i', $word);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testAssertRegExp
|
||||
*/
|
||||
public function testSkipNonStringTag($assertRegExp)
|
||||
{
|
||||
$lipsum = new LoremIpsum();
|
||||
$this->$assertRegExp('/^[a-z]+$/i', $lipsum->word(123));
|
||||
$this->$assertRegExp('/^[a-z]+$/i', $lipsum->word(array(1, 2, 3)));
|
||||
$this->$assertRegExp('/^[a-z]+$/i', $lipsum->word(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue