Pest PHP Snippets
Pest PHP V2 Snippets for Sublime Text
Details
Installs
- Total 128
- Win 80
- Mac 27
- Linux 21
Sep 15 | Sep 14 | Sep 13 | Sep 12 | Sep 11 | Sep 10 | Sep 9 | Sep 8 | Sep 7 | Sep 6 | Sep 5 | Sep 4 | Sep 3 | Sep 2 | Sep 1 | Aug 31 | Aug 30 | Aug 29 | Aug 28 | Aug 27 | Aug 26 | Aug 25 | Aug 24 | Aug 23 | Aug 22 | Aug 21 | Aug 20 | Aug 19 | Aug 18 | Aug 17 | Aug 16 | Aug 15 | Aug 14 | Aug 13 | Aug 12 | Aug 11 | Aug 10 | Aug 9 | Aug 8 | Aug 7 | Aug 6 | Aug 5 | Aug 4 | Aug 3 | Aug 2 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Windows | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 0 | 0 | 0 |
Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
Readme
- Source
- raw.githubusercontent.com
Pest PHP Sublime Text Snippets
Credits
This package was inspired by the vs-code pest-snippets package
Installation
Use Sublime Text's Package Control to install this package.
About
Pest PHP Sublime Text Sublime Snippets is a compilation of code snippets for writing tests with Pest PHP v2.
Code snippets are templates for the codes you use most often.
Using snippets allows you to write code faster, boosting your productivity, and preventing mistakes.
⭐ Please consider starring the GitHub repository if you find this package useful.
🚀 Quick start
Just type :p
to get a list of all code snippets.
Additionally, you can type:
:pte
to access alltest()
snippets.:pti
to access allit()
snippets.:pex
to access the availableexpect()
methods.
🗒️ Code Snippet List
Test templates
Pest provides two functions for writing tests: test()
and it()
.
Type :pte
+ [TAB] to use the test()
function:
test("", function () {
//expect()->
});
Type :pit
+ [TAB] to the ìt()
function:
it("", function () {
//expect()->
});
Skipping tests
Type :ptes
/ :pits
to create a test with skip()
:
test("", function () {
//...
})->skip();
Skipping tests (Todo)
Type :petodo
/ :pitodo
+ [TAB] to create a test with todo()
:
test("", function () {
//...
})->todo();
Skipping tests (WIP)
WIP stands for “Work In Progress”.
Type :ptewip
/ :pitwip
to create a test with skip('wip')
:
test("", function () {
//...
})->skip("wip");
Groups of tests
Type :pteg
/ :pitg
+ [TAB] to create a test with group()
:
test("", function () {
//...
})->group();
Datasets
Type :pted
/ :pitd
+ [TAB] to create a test with with()
:
test("", function () {
//...
})->with();
Type :pteld
/ :pitld
+ [TAB] to create a test with with()
using Lazy datasets:
test("", function () {
//...
})->with(function () {
yield "";
});
Exceptions & Errors
Type :ptet
/ :pitt
+ [TAB] to create a test with throws()
:
test("throws exception", function () {
//...
})->throws();
Type :ptetif
/ :pittif
+ [TAB] to create a test with throwsIf()
:
test("throws exception if...", function () {
//...
})->throwsIf();
Type :penoex
/ :pitnoex
+ [TAB] to create a test with throwsNoExceptions()
:
test("throws no exceptions", function () {
//...
})->throwsNoExceptions();
Setup and teardown
Type :pbe
+ [TAB] to create a beforeEach()
function:
beforeEach(function () {
//...
});
Type :pae
+ [TAB] to create a afterEach()
function:
afterEach(function () {
//...
});
Type :pba
+ [TAB] to create a beforeAll()
function:
beforeAll(function () {
//...
});
Type :paa
+ [TAB] to create a afterAll()
function:
afterAll(function () {
//...
});
Expectation API
Type :pex
+ [TAB] to create a expect()
function:
expect();
Then, type :pex
and use your keyboard to move through all the different expectation
methods.
For example, type: pex
+ [TAB] and then :pextobe
+ [TAB] results in:
expect()->toBe();
Available expect()
methods:
| Trigger | Snippet |
| —————————– | —————————- |
| : pex
| expect()-> |
| : pextobe
| ->toBe() |
| : pextobearray
| ->toBeArray() |
| : pextobeempty
| ->toBeEmpty() |
| : pextobetrue
| ->toBeTrue() |
| : pextobetruthy
| ->toBeTruthy() |
| : pextobefalse
| ->toBeFalse() |
| : pextobefalsy
| ->toBeFalsy() |
| : pextobegreaterthan
| ->toBeGreaterThan() |
| : pextobegreaterthanorequal
| ->toBeGreaterThanOrEqual() |
| : pextobelessthan
| ->toBeLessThan() |
| : pextobelessthanorequal
| ->toBeLessThanOrEqual() |
| : pextocontain
| ->toContain() |
| : pextocontainonlyins
| ->toContainOnlyInstancesOf() |
| : pextohavecount
| ->toHaveCount() |
| : pextohavemethod
| ->toHaveMethod() |
| : pextohavemethods
| ->toHaveMethods() |
| : pextohaveproperty
| ->toHaveProperty() |
| : pextohaveproperties
| ->toHaveProperties() |
| : pextomatcharray
| ->toMatchArray() |
| : pextomatchobject
| ->toMatchObject() |
| : pextoequal
| ->toEqual() |
| : pextoequalcanonicalizing
| ->toEqualCanonicalizing() |
| : pextoequalwithdelta
| ->toEqualWithDelta() |
| : pextobein
| ->toBeIn() |
| : pextobeinfinite
| ->toBeInfinite() |
| : pextobeinstanceof
| ->toBeInstanceOf() |
| : pextobebool
| ->toBeBool() |
| : pextobecallable
| ->toBeCallable() |
| : pextobefloat
| ->toBeFloat() |
| : pextobeint
| ->toBeInt() |
| : pextobeiterable
| ->toBeIterable() |
| : pextobenumeric
| ->toBeNumeric() |
| : pextobeobject
| ->toBeObject() |
| : pextoberesource
| ->toBeResource() |
| : pextobescalar
| ->toBeScalar() |
| : pextobestring
| ->toBeString() |
| : pextobejson
| ->toBeJson() |
| : pextobenan
| ->toBeNan() |
| : pextobenull
| ->toBeNull() |
| : pextohavekey
| ->toHaveKey() |
| : pextohavekeys
| ->toHaveKeys() |
| : pextohavelength
| ->toHaveLength() |
| : pextobefile
| ->toBeFile() |
| : pextobedirectory
| ->toBeDirectory() |
| : pextobereadabledirectory
| ->toBeReadableDirectory() |
| : pextobereadablefile
| ->toBeReadableFile() |
| : pextobewritabledirectory
| ->toBeWritableDirectory() |
| : pextobewritablefile
| ->toBeWritableFile() |
| : pextostartwith
| ->toStartWith() |
| : pextothrow
| ->toThrow() |
| : pextoendwith
| ->toEndWith() |
| : pextomatch
| ->toMatch() |
| : pextomatchconstraint
| ->toMatchConstraint() |
| : pexdd
| ->dd() |
| : pexray
| ->ray() |
| : pexjson
| ->json()-> |
| : pexand
| ->and()-> |
| : pexnot
| ->not()-> |
| : pexdef
| ->defer()-> |
| : pexeach
| ->each()-> |
| : pexsequence
| ->sequence() |
| : pexwhen
| ->when() |
| : pexunless
| ->unless() |
| : pexunless
| ->unless() |