Limited-Time Special Use Code to Get 30% Off Your First Buying EduBank. Find out more!

Pest V2.16 - Native Function Checks, New String Expectations, And More

img
Author

Emily Harrison

Student
  • Posts: 17
  • Member since: 2024-08-26
  • Location: West Barminghum, Nyc

img 2024-08-27 - 12:53 AM

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 easily check for things like "toBeCamelCase", "toBeSnakeCase", and more:


expect('abcDef')->toBeCamelCase();
expect('abc-def')->toBeKebabCase();
expect('abc_def')->toBeSnakeCase();
expect('AbcDef')->toBeStudlyCase();

Pest expect 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

Attachments:

Login to view attachments

img
Author

Emily Harrison

Student
  • Posts: 17
  • Member since: 2024-08-26
  • Location: West Barminghum, Nyc

img 2024-08-27 - 12:55 AM

Reply to Emily Harrison

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 easily check for things like "toBeCamelCase", "toBeSnakeCase", and more:


expect('abcDef')->toBeCamelCase();
expect('abc-def')->toBeKebabCase();
expect('abc_def')->toBeSnakeCase();
expect('AbcDef')->toBeStudlyCase();

Pest expect 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


This is a test reply for the comment.

echo 'Hello World';
Reply to the topic

Choose an attachment

Eager to Receive Special Offers & Updates on Courses?