Pest v2.16 released
Pest now comes with native function checks, new string expectations, and more
Nuno Maduro announced on X that Pest v2.16 is now out. This update comes packed with native functions support on the arch plugin, fresh expectations, and more. Here is a quick example of the new features:
expect(['die', 'eval', 'sleep'])->not->toBeUsed();
expect('abcDef')->toBeCamelCase();
expect('abc-def')->toBeKebabCase();
expect('abc_def')->toBeSnakeCase();
expect('AbcDef')->toBeStudlyCase();
expect('9001 ')->toBeDigits(); // failed because of the space.
expect('9001')->toBeDigits(); // true
Pest Native Functions Support
You can now make sure that certain native functions aren't used in your application:
expect(['die', 'eval', 'sleep'])
->not
->toBeUsed();
Pest String Case Expectations
This means you can quickly check for things like "toBeCamelCase", "toBeSnakeCase", and more:
expect('abcDef')->toBeCamelCase();
expect('abc-def')->toBeKebabCase();
expect('abc_def')->toBeSnakeCase();
expect('AbcDef')->toBeStudlyCase();
Pest expect the string to be digits
Need to verify if a given string contains only digits:
expect('9001 ')->toBeDigits();
// fails because of the space.
expect('9001')->toBeDigits);
// success