├── .vscode └── launch.json ├── .vscodeignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── compile.sh ├── dist └── pest-snippets-2.0.0.vsix ├── images ├── icon.png └── screenshot.gif ├── package.json └── snippets ├── expect.json └── snippets.json /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | // A launch configuration that launches the extension inside a new window 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | { 6 | "version": "0.2.0", 7 | "configurations": [ 8 | { 9 | "name": "Extension", 10 | "type": "extensionHost", 11 | "request": "launch", 12 | "args": [ 13 | "--extensionDevelopmentPath=${workspaceFolder}" 14 | ] 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /.vscodeignore: -------------------------------------------------------------------------------- 1 | .vscode/** 2 | .vscode-test/** 3 | .gitignore 4 | vsc-extension-quickstart.md 5 | compile.sh 6 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | 3 | All notable changes to the "pest-snippets" extension will be documented in this file. 4 | 5 | ## [2.0.0] 6 | 7 | - Ready for Pest V2 8 | - Added `:petodo` and `:pitodo` to generate a test with `->todo()` 9 | - Added `:penoex` and `:pitnoex` to generate a test with `->throwsNoExceptions()` 10 | - Added `:pextobearray` for `->toBeArray()` 11 | - Added `:pextocontainonlyins` for `->toContainOnlyInstancesOf()` 12 | - Added `:pextohavemethod` for `->toHaveMethod()` 13 | - Added `:pextohavemethods` for `->toHaveMethods()` 14 | - Added `:pextobefile` for `->toBeFile()` 15 | - Added `:pextobereadablefile` for `->toBeReadableFile()` 16 | - Added `:pextobewritablefile` for `->toBeWritableFile()` 17 | - Added `:pexdef` for `->defer()->` 18 | - Improved `throwsIf` snippet 19 | - Removed `:pextap` due to deprecation of `->tap()` 20 | - Removed `:pteo` and `:pito` due to deprecation of `->only()` 21 | 22 | ```php 23 | test('throws no exceptions', function () { 24 | //... 25 | })->throwsNoExceptions(); 26 | ``` 27 | 28 | ## [1.0.7] 29 | 30 | - DOC: README improvements 31 | - Modified logo 32 | - Updated screenshot 33 | - Added LICENSE 34 | - Added `:pextothrow` for `->toThrow()` 35 | - Added compile.sh script 36 | 37 | ## [1.0.6] 38 | 39 | - Fixed and update README.md 40 | - Changed `:ptet` into `->test()->throws()` 41 | - Changed `:pitt` into `->it()->throws()` 42 | - Added `:ptetif` for `->test()->throwsIf()` 43 | - Added `:pittif` for `->it()->throwsIf()` 44 | 45 | ## [1.0.5] 46 | 47 | - Added `:pextohaveproperties` for `->toHaveProperties()` 48 | - Added `:pexwhen` for `->when()` 49 | - Added `:pexunless` for `->unless()` 50 | - Added `:pexmatch` for `->match()` 51 | - Added `:ptet` for `test()->throwsIf()` 52 | - Added `:pitt` for `it()->throwsIf()` 53 | 54 | ## [1.0.4] 55 | 56 | - Added `:pextohavelength` for `->toHaveLength()` 57 | 58 | ## [1.0.3] 59 | 60 | - Added `:pextothrow` for `->toThrow()` 61 | 62 | ## [1.0.2] 63 | 64 | - Added `:pextobetruthy` for `->toBeTruthy()` 65 | - Added `:pextobefalsy` for `->toBeFalsy()` method 66 | 67 | ## [1.0.1] 68 | 69 | - Added `:pextobein` for `->toBeIn()` 70 | - Added `:pextap` for `->tap()` method 71 | 72 | ## [1.0.0] 73 | 74 | - Removed `->` from `pex:` 75 | - Removed indentation from every `pex:...` 76 | - Removed expect() from every `pex:...` 77 | - Removed uncessary key focousing from `pex:...` which do not accept arguments 78 | - Added `:pexjson` for `json()` method from Pest 1.6.0 79 | - Added `:pextobedirectory` for `->toBeDirectory()` 80 | - Added `:ptewip` and `pitwip` for creating test functions with Skip->('wip') 81 | 82 | ## [0.1.0] 83 | 84 | - Initial release of Pest Snippets extension 85 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 DanSysAnalyst 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pest Snippets 2 | 3 | **Ready for Pest v2** 4 | 5 | Pest Snippets is a compilation of code snippets for writing tests with [Pest PHP](https://pestphp.com/). 6 | 7 | Code snippets are templates for the codes you use most often. 8 | 9 | Using snippets allows you to write code faster, boosting your productivity, and preventing mistakes. 10 | 11 | ⭐ Please consider starring the [GitHub repository](https://github.com/dansysanalyst/pest-snippets) if you find this extension useful. 12 | 13 | ## 🚀 Quick start 14 | 15 | Just type `:p` to get a list of all code snippets. 16 | 17 | Additionally, you can type: 18 | 19 | - `:pte` to access all `test()` snippets. 20 | 21 | - `:pti` to access all `it()` snippets. 22 | 23 | - `:pex` to access the available `expect()` methods. 24 | 25 | ![Screenshot](https://github.com/dansysanalyst/pest-snippets/raw/main/images/screenshot.gif) 26 | 27 | ## 🗒️ Code Snippet List 28 | 29 | ### Test templates 30 | 31 | Pest provides two functions for writing tests: `test()` and `it()`. 32 | 33 | Type `:pte` + [TAB] to use the `test()` function: 34 | 35 | ```php 36 | test('', function () { 37 | //expect()-> 38 | }); 39 | ``` 40 | 41 | Type `:pit` + [TAB] to the `ìt()` function: 42 | 43 | ```php 44 | it('', function () { 45 | //expect()-> 46 | }); 47 | ``` 48 | 49 | #### Skipping tests 50 | 51 | Type `:ptes` / `:pits` to create a test with `skip()`: 52 | 53 | ```php 54 | test('', function () { 55 | //... 56 | })->skip(); 57 | ``` 58 | 59 | Type `:petodo` / `:pitodo` + [TAB] to create a test with `todo()`: 60 | 61 | ```php 62 | test('', function () { 63 | //... 64 | })->todo(); 65 | ``` 66 | 67 | #### Skipping tests (WIP) 68 | 69 | WIP stands for "Work In Progress". 70 | 71 | Type `:ptewip` / `:pitwip` to create a test with `skip('wip')`: 72 | 73 | ```php 74 | test('', function () { 75 | //... 76 | })->skip('wip'); 77 | ``` 78 | 79 | #### Groups of tests 80 | 81 | Type `:pteg` / `:pitg` + [TAB] to create a test with `group()`: 82 | 83 | ```php 84 | test('', function () { 85 | //... 86 | })->group(); 87 | ``` 88 | 89 | #### Datasets 90 | 91 | Type `:pted` / `:pitd` + [TAB] to create a test with `with()`: 92 | 93 | ```php 94 | test('', function () { 95 | //... 96 | })->with(); 97 | ``` 98 | 99 | Type `:pteld` / `:pitld` + [TAB] to create a test with `with()` using Lazy datasets: 100 | 101 | ```php 102 | test('', function () { 103 | //... 104 | })-> with(function () { 105 | yield ''; 106 | }); 107 | ``` 108 | 109 | ### Exceptions & Errors 110 | 111 | Type `:ptet` / `:pitt` + [TAB] to create a test with `throws()`: 112 | 113 | ```php 114 | test('throws exception', function () { 115 | //... 116 | })->throws(); 117 | ``` 118 | 119 | Type `:ptetif` / `:pittif` + [TAB] to create a test with `throwsIf()`: 120 | 121 | ```php 122 | test('throws exception if...', function () { 123 | //... 124 | })->throwsIf(); 125 | ``` 126 | 127 | Type `:penoex` / `:pitnoex` + [TAB] to create a test with `throwsNoExceptions()`: 128 | 129 | ```php 130 | test('throws no exceptions', function () { 131 | //... 132 | })->throwsNoExceptions(); 133 | ``` 134 | 135 | ### Setup and teardown 136 | 137 | Type `:pbe` + [TAB] to create a `beforeEach()` function: 138 | 139 | ```php 140 | beforeEach(function () { 141 | //... 142 | }); 143 | ``` 144 | 145 | Type `:pae` + [TAB] to create a `afterEach()` function: 146 | 147 | ```php 148 | afterEach(function () { 149 | //... 150 | }); 151 | ``` 152 | 153 | Type `:pba` + [TAB] to create a `beforeAll()` function: 154 | 155 | ```php 156 | beforeAll(function () { 157 | //... 158 | }); 159 | ``` 160 | 161 | Type `:paa` + [TAB] to create a `afterAll()` function: 162 | 163 | ```php 164 | afterAll(function () { 165 | //... 166 | }); 167 | ``` 168 | 169 | ### Expectation API 170 | 171 | Type `:pex` + [TAB] to create a `expect()` function: 172 | 173 | ```php 174 | expect() 175 | ``` 176 | 177 | Then, type `:pex` and use your keyboard to move through all the different `expectation` methods. 178 | 179 | For example, type: `pex` + [TAB] and then `:pextobe` + [TAB] results in: 180 | 181 | ```php 182 | expect()->toBe() 183 | ``` 184 | 185 | Available `expect()` methods: 186 | | Trigger | Snippet | 187 | | ----------------------------- | ---------------------------- | 188 | | : `pex` | expect()-> | 189 | | : `pextobe` | ->toBe() | 190 | | : `pextobearray` | ->toBeArray() | 191 | | : `pextobeempty` | ->toBeEmpty() | 192 | | : `pextobetrue` | ->toBeTrue() | 193 | | : `pextobetruthy` | ->toBeTruthy() | 194 | | : `pextobefalse` | ->toBeFalse() | 195 | | : `pextobefalsy` | ->toBeFalsy() | 196 | | : `pextobegreaterthan` | ->toBeGreaterThan() | 197 | | : `pextobegreaterthanorequal` | ->toBeGreaterThanOrEqual() | 198 | | : `pextobelessthan` | ->toBeLessThan() | 199 | | : `pextobelessthanorequal` | ->toBeLessThanOrEqual() | 200 | | : `pextocontain` | ->toContain() | 201 | | : `pextocontainonlyins` | ->toContainOnlyInstancesOf() | 202 | | : `pextohavecount` | ->toHaveCount() | 203 | | : `pextohavemethod` | ->toHaveMethod() | 204 | | : `pextohavemethods` | ->toHaveMethods() | 205 | | : `pextohaveproperty` | ->toHaveProperty() | 206 | | : `pextohaveproperties` | ->toHaveProperties() | 207 | | : `pextomatcharray` | ->toMatchArray() | 208 | | : `pextomatchobject` | ->toMatchObject() | 209 | | : `pextoequal` | ->toEqual() | 210 | | : `pextoequalcanonicalizing` | ->toEqualCanonicalizing() | 211 | | : `pextoequalwithdelta` | ->toEqualWithDelta() | 212 | | : `pextobein` | ->toBeIn() | 213 | | : `pextobeinfinite` | ->toBeInfinite() | 214 | | : `pextobeinstanceof` | ->toBeInstanceOf() | 215 | | : `pextobebool` | ->toBeBool() | 216 | | : `pextobecallable` | ->toBeCallable() | 217 | | : `pextobefloat` | ->toBeFloat() | 218 | | : `pextobeint` | ->toBeInt() | 219 | | : `pextobeiterable` | ->toBeIterable() | 220 | | : `pextobenumeric` | ->toBeNumeric() | 221 | | : `pextobeobject` | ->toBeObject() | 222 | | : `pextoberesource` | ->toBeResource() | 223 | | : `pextobescalar` | ->toBeScalar() | 224 | | : `pextobestring` | ->toBeString() | 225 | | : `pextobejson` | ->toBeJson() | 226 | | : `pextobenan` | ->toBeNan() | 227 | | : `pextobenull` | ->toBeNull() | 228 | | : `pextohavekey` | ->toHaveKey() | 229 | | : `pextohavekeys` | ->toHaveKeys() | 230 | | : `pextohavelength` | ->toHaveLength() | 231 | | : `pextobefile` | ->toBeFile() | 232 | | : `pextobedirectory` | ->toBeDirectory() | 233 | | : `pextobereadabledirectory` | ->toBeReadableDirectory() | 234 | | : `pextobereadablefile` | ->toBeReadableFile() | 235 | | : `pextobewritabledirectory` | ->toBeWritableDirectory() | 236 | | : `pextobewritablefile` | ->toBeWritableFile() | 237 | | : `pextostartwith` | ->toStartWith() | 238 | | : `pextothrow` | ->toThrow() | 239 | | : `pextoendwith` | ->toEndWith() | 240 | | : `pextomatch` | ->toMatch() | 241 | | : `pextomatchconstraint` | ->toMatchConstraint() | 242 | | : `pexdd` | ->dd() | 243 | | : `pexray` | ->ray() | 244 | | : `pexjson` | ->json()-> | 245 | | : `pexand` | ->and()-> | 246 | | : `pexnot` | ->not()-> | 247 | | : `pexdef` | ->defer()-> | 248 | | : `pexeach` | ->each()-> | 249 | | : `pexsequence` | ->sequence() | 250 | | : `pexwhen` | ->when() | 251 | | : `pexunless` | ->unless() | 252 | | : `pexunless` | ->unless() | 253 | -------------------------------------------------------------------------------- /compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | NC='\033[0m' 4 | RED='\033[0;31m' 5 | GREEN='\033[0;32m' 6 | YELLOW='\033[1;33m' 7 | 8 | #=============================| HELPERS |================================================ 9 | 10 | function msg::info() 11 | { 12 | LABEL_INFO="\n\033[0;38;5;227;48;5;38m 👉 INFO ${NC}" 13 | echo -e "\n${LABEL_INFO} $1\n" 14 | } 15 | 16 | function msg::error() 17 | { 18 | LABEL_ERROR="\n\033[048;5;9m ❌ ERROR ${NC}" 19 | echo -e "\n${LABEL_ERROR} $1\n" 20 | } 21 | 22 | function throwException() 23 | { 24 | msg::error "$1" 25 | exit 1; 26 | } 27 | 28 | function checkDependencies() 29 | { 30 | if [[ ! -f "./package.json" ]]; then 31 | throwException "Error could not find ${RED}package.json${NC} in dir. Aborting!" 32 | fi 33 | 34 | if ! node --version >/dev/null 2>&1; then 35 | throwException "${RED}NodeJS${NC} is required. Aborting!" 36 | fi 37 | 38 | if ! vsce --version >/dev/null 2>&1; then 39 | throwException "${RED}VSCE${NC} is required. Aborting!" 40 | fi 41 | } 42 | 43 | # @See: https://stackoverflow.com/a/24319367 44 | function isVersionValid() 45 | { 46 | if [ $# -eq 0 ]; then 47 | throwException "You must inform a version!" 48 | fi 49 | 50 | if [[ ! $1 =~ ^[0-9]+\.[0-9]+ ]]; then 51 | throwException "Invalid '${RED}($1)${NC}' version provided. Aborting!" 52 | fi 53 | } 54 | 55 | function getVersionFromPackageJson() 56 | { 57 | VERSION=$(node -p "require('./package.json').version") 58 | 59 | isVersionValid "$VERSION" 60 | echo "$VERSION" 61 | } 62 | 63 | # @See https://stackoverflow.com/a/73710486 64 | function incrementVersion() 65 | { 66 | if [ $# -eq 0 ]; then 67 | throwException "You must inform a version!" 68 | fi 69 | 70 | isVersionValid "$1" 71 | 72 | NEXT_VERSION=$(echo "$1" | awk -F. -v OFS=. '{$NF += 1 ; print}') 73 | 74 | isVersionValid "$NEXT_VERSION" 75 | 76 | echo "$NEXT_VERSION" 77 | } 78 | 79 | function updagreToVersion() 80 | { 81 | if [ $# -eq 0 ]; then 82 | throwException "You must inform a version!" 83 | fi 84 | 85 | isVersionValid "$1" 86 | 87 | VERSION_STRING='"version": ' 88 | 89 | sed -i '' "s/\($VERSION_STRING\).*/\1\"$1\",/" package.json 90 | } 91 | 92 | function addChangelog() 93 | { 94 | if [ $# -eq 0 ]; then 95 | throwException "You must inform a version!" 96 | fi 97 | 98 | if [[ ! -f "./CHANGELOG.md" ]]; then 99 | touch ./CHANGELOG.md 100 | fi 101 | 102 | isVersionValid "$1" 103 | 104 | sed -i "" -e $'4 a\\\n'"## [$1]" CHANGELOG.md 105 | sed -i "" -e $'5 a\\\n' CHANGELOG.md 106 | sed -i "" -e $'6 a\\\n'"- my change here" CHANGELOG.md 107 | sed -i "" -e $'7 a\\\n' CHANGELOG.md 108 | } 109 | 110 | compileExtension() 111 | { 112 | if ls ./*.vsix >/dev/null 2>&1; then 113 | rm ./*.vsix 114 | fi 115 | 116 | msg::info compiling... 117 | 118 | vsce package 119 | } 120 | 121 | #=================================| Script |============================================= 122 | 123 | checkDependencies 124 | 125 | VERSION=$(getVersionFromPackageJson) 126 | 127 | echo -e "Current version ${YELLOW}${VERSION}${NC}. Would you like to ${GREEN}[B]${NC}ump or ${GREEN}[E]${NC}nter a custom version?" 128 | read -rn1 CHOICE 129 | 130 | case "$CHOICE" in 131 | [bB]) 132 | UPDATE_TO=$(incrementVersion "$VERSION") 133 | ;; 134 | [eE]) 135 | echo -e "Enter the new version:" 136 | read -r UPDATE_TO 137 | ;; 138 | *) 139 | throwException "Invalid choice. Aborting!" 140 | ;; 141 | esac 142 | 143 | updagreToVersion "$UPDATE_TO" 144 | 145 | VERSION=$(getVersionFromPackageJson) 146 | 147 | msg::info "Upgraded to ${GREEN}${VERSION}${NC}." 148 | 149 | addChangelog "$VERSION" 150 | 151 | echo -e "Proceed to compile? ${GREEN}[y/N]${NC}" 152 | read -rn1 ANSWER 153 | 154 | case "$ANSWER" in 155 | [yY][eE][sS]|[yY]) 156 | compileExtension 157 | ;; 158 | *) 159 | throwException "Invalid choice. Aborting!" 160 | ;; 161 | esac 162 | -------------------------------------------------------------------------------- /dist/pest-snippets-2.0.0.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dansysanalyst/pest-snippets/5890ed84d05d5f42127e19bb1e162524e47b1a9c/dist/pest-snippets-2.0.0.vsix -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dansysanalyst/pest-snippets/5890ed84d05d5f42127e19bb1e162524e47b1a9c/images/icon.png -------------------------------------------------------------------------------- /images/screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dansysanalyst/pest-snippets/5890ed84d05d5f42127e19bb1e162524e47b1a9c/images/screenshot.gif -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "pest-snippets", 3 | "displayName": "Pest Snippets", 4 | "publisher": "dansysanalyst", 5 | "description": "Snippets for Pest PHP testing framework", 6 | "version": "2.0.0", 7 | "engines": { 8 | "vscode": "^1.57.0" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/dansysanalyst/pest-snippets.git" 13 | }, 14 | "icon": "images/icon.png", 15 | "galleryBanner": { 16 | "color": "#7259A0", 17 | "theme": "dark" 18 | }, 19 | "categories": [ 20 | "Other" 21 | ], 22 | "contributes": { 23 | "snippets": [ 24 | { 25 | "language": "php", 26 | "path": "./snippets/snippets.json" 27 | }, 28 | { 29 | "language": "php", 30 | "path": "./snippets/expect.json" 31 | } 32 | ] 33 | } 34 | } -------------------------------------------------------------------------------- /snippets/expect.json: -------------------------------------------------------------------------------- 1 | { 2 | "expect()": { 3 | "scope": "php", 4 | "prefix": ":pex", 5 | "body": [ 6 | "expect()"], 7 | "description": "Pest expect()" 8 | }, 9 | "->toBe()": { 10 | "scope": "php", 11 | "prefix": ":pextobe", 12 | "body": [ 13 | "->toBe(${1:});\n"], 14 | "description": "Pest ->toBe()" 15 | }, 16 | "->toBeArray()": { 17 | "scope": "php", 18 | "prefix": ":pextobearray", 19 | "body": [ 20 | "->toBeArray(${1:});\n"], 21 | "description": "Pest ->toBeArray()" 22 | }, 23 | "->toBeEmpty();": { 24 | "scope": "php", 25 | "prefix": ":pextobeempty", 26 | "body": [ 27 | "->toBeEmpty();\n"], 28 | "description": "Pest ->toBeEmpty()" 29 | }, 30 | "->toBeTrue()": { 31 | "scope": "php", 32 | "prefix": ":pextobetrue", 33 | "body": [ 34 | "->toBeTrue();\n"], 35 | "description": "Pest ->toBeTrue()" 36 | }, 37 | "->toBeTruthy()": { 38 | "scope": "php", 39 | "prefix": ":pextobetruthy", 40 | "body": [ 41 | "->toBeTruthy();\n"], 42 | "description": "Pest ->toBeTruthy()" 43 | }, 44 | "->toBeFalse()": { 45 | "scope": "php", 46 | "prefix": ":pextobefalse", 47 | "body": [ 48 | "->toBeFalse();\n"], 49 | "description": "Pest ->toBeFalse()" 50 | }, 51 | "->toBeFalsy()": { 52 | "scope": "php", 53 | "prefix": ":pextobefalsy", 54 | "body": [ 55 | "->toBeFalsy();\n"], 56 | "description": "Pest ->toBeFalsy()" 57 | }, 58 | "->toBeGreaterThan()": { 59 | "scope": "php", 60 | "prefix": ":pextobegreaterthan", 61 | "body": [ 62 | "->toBeGreaterThan(${1:});\n"], 63 | "description": "Pest ->toBeGreaterThan()" 64 | }, 65 | "->toBeGreaterThanOrEqual()": { 66 | "scope": "php", 67 | "prefix": ":pextobegreaterthanorequal", 68 | "body": [ 69 | "->toBeGreaterThanOrEqual(${1:});\n"], 70 | "description": "Pest ->toBeGreaterThanOrEqual()" 71 | }, 72 | "->toBeLessThan()": { 73 | "scope": "php", 74 | "prefix": ":pextobelessthan", 75 | "body": [ 76 | "->toBeLessThan(${1:});\n"], 77 | "description": "Pest ->toBeLessThan()" 78 | }, 79 | "->toBeLessThanOrEqual()": { 80 | "scope": "php", 81 | "prefix": ":pextobelessthanorequal", 82 | "body": [ 83 | "->toBeLessThanOrEqual(${1:});\n"], 84 | "description": "Pest ->toBeLessThanOrEqual()" 85 | }, 86 | "->toContain()": { 87 | "scope": "php", 88 | "prefix": ":pextocontain", 89 | "body": [ 90 | "->toContain(${1:});\n"], 91 | "description": "Pest ->toContain()" 92 | }, 93 | "->toContainOnlyInstancesOf()": { 94 | "scope": "php", 95 | "prefix": ":pextocontainonlyins", 96 | "body": [ 97 | "->toContainOnlyInstancesOf(${1:});\n"], 98 | "description": "Pest ->toContainOnlyInstancesOf()" 99 | }, 100 | "->toHaveCount()": { 101 | "scope": "php", 102 | "prefix": ":pextohavecount", 103 | "body": [ 104 | "->toHaveCount(${1:});\n"], 105 | "description": "Pest ->toHaveCount()" 106 | }, 107 | "->pextohavemethod()": { 108 | "scope": "php", 109 | "prefix": ":pextohavemethod", 110 | "body": [ 111 | "->pextohavemethod(${1:});\n"], 112 | "description": "Pest ->pextohavemethod()" 113 | }, 114 | "->pextohavemethods()": { 115 | "scope": "php", 116 | "prefix": ":pextohavemethods", 117 | "body": [ 118 | "->pextohavemethods(${1:});\n"], 119 | "description": "Pest ->pextohavemethods()" 120 | }, 121 | "->toHaveProperty()": { 122 | "scope": "php", 123 | "prefix": ":pextohaveproperty", 124 | "body": [ 125 | "->toHaveProperty(${1:});\n"], 126 | "description": "Pest ->toHaveProperty()" 127 | }, 128 | "->toHaveProperties()": { 129 | "scope": "php", 130 | "prefix": ":pextohaveproperties", 131 | "body": [ 132 | "->toHaveProperties(${1:});\n"], 133 | "description": "Pest ->toHaveProperties()" 134 | }, 135 | "->toMatchArray()": { 136 | "scope": "php", 137 | "prefix": ":pextomatcharray", 138 | "body": [ 139 | "->toMatchArray(${1:});\n"], 140 | "description": "Pest ->toMatchArray()" 141 | }, 142 | "->toMatchObject()": { 143 | "scope": "php", 144 | "prefix": ":pextomatchobject", 145 | "body": [ 146 | "->toMatchObject(${1:});\n"], 147 | "description": "Pest ->toMatchObject()" 148 | }, 149 | "->toEqual()": { 150 | "scope": "php", 151 | "prefix": ":pextoequal", 152 | "body": [ 153 | "->toEqual(${1:});\n"], 154 | "description": "Pest ->toEqual()" 155 | }, 156 | "->toEqualCanonicalizing()": { 157 | "scope": "php", 158 | "prefix": ":pextoequalcanonicalizing", 159 | "body": [ 160 | "->toEqualCanonicalizing(${1:});\n"], 161 | "description": "Pest ->toEqualCanonicalizing()" 162 | }, 163 | "->toEqualWithDelta()": { 164 | "scope": "php", 165 | "prefix": ":pextoequalwithdelta", 166 | "body": [ 167 | "->toEqualWithDelta(${1:});\n"], 168 | "description": "Pest ->toEqualWithDelta()" 169 | }, 170 | "->toBeIn()": { 171 | "scope": "php", 172 | "prefix": ":pextobein", 173 | "body": [ 174 | "->toBeIn();\n"], 175 | "description": "Pest ->toBeIn()" 176 | }, 177 | "->toBeInfinite()": { 178 | "scope": "php", 179 | "prefix": ":pextobeinfinite", 180 | "body": [ 181 | "->toBeInfinite();\n"], 182 | "description": "Pest ->toBeInfinite()" 183 | }, 184 | "->toBeInstanceOf()": { 185 | "scope": "php", 186 | "prefix": ":pextobeinstanceof", 187 | "body": [ 188 | "->toBeInstanceOf(${1:});\n"], 189 | "description": "Pest ->toBeInstanceOf()" 190 | }, 191 | "->toBeBool()": { 192 | "scope": "php", 193 | "prefix": ":pextobebool", 194 | "body": [ 195 | "->toBeBool();\n"], 196 | "description": "Pest ->toBeBool()" 197 | }, 198 | "->toBeCallable()": { 199 | "scope": "php", 200 | "prefix": ":pextobecallable", 201 | "body": [ 202 | "->toBeCallable();\n"], 203 | "description": "Pest ->toBeCallable()" 204 | }, 205 | "->toBeFile()": { 206 | "scope": "php", 207 | "prefix": ":pextobefile", 208 | "body": [ 209 | "->toBeFile();\n"], 210 | "description": "Pest ->toBeFile()" 211 | }, 212 | "->toBeFloat()": { 213 | "scope": "php", 214 | "prefix": ":pextobefloat", 215 | "body": [ 216 | "->toBeFloat();\n"], 217 | "description": "Pest ->toBeFloat()" 218 | }, 219 | "->toBeInt()": { 220 | "scope": "php", 221 | "prefix": ":pextobeint", 222 | "body": [ 223 | "->toBeInt();\n"], 224 | "description": "Pest ->toBeInt()" 225 | }, 226 | "PestExpectToBeIterable": { 227 | "scope": "php", 228 | "prefix": ":pextobeiterable", 229 | "body": [ 230 | "->toBeIterable();\n"], 231 | "description": "Pest ->toBeIterable()" 232 | }, 233 | "->toBeNumeric()": { 234 | "scope": "php", 235 | "prefix": ":pextobenumeric", 236 | "body": [ 237 | "->toBeNumeric();\n"], 238 | "description": "Pest ->toBeNumeric()" 239 | }, 240 | "->toBeObject()": { 241 | "scope": "php", 242 | "prefix": ":pextobeobject", 243 | "body": [ 244 | "->toBeObject();\n"], 245 | "description": "Pest ->toBeObject()" 246 | }, 247 | "->toBeResource()": { 248 | "scope": "php", 249 | "prefix": ":pextoberesource", 250 | "body": [ 251 | "->toBeResource();\n"], 252 | "description": "Pest ->toBeResource()" 253 | }, 254 | "->toBeScalar()": { 255 | "scope": "php", 256 | "prefix": ":pextobescalar", 257 | "body": [ 258 | "->toBeScalar();\n"], 259 | "description": "Pest ->toBeScalar()" 260 | }, 261 | "->toBeString()": { 262 | "scope": "php", 263 | "prefix": ":pextobestring", 264 | "body": [ 265 | "->toBeString();\n"], 266 | "description": "Pest ->toBeString()" 267 | }, 268 | "->toBeJson()": { 269 | "scope": "php", 270 | "prefix": ":pextobejson", 271 | "body": [ 272 | "->toBeJson();\n"], 273 | "description": "Pest ->toBeJson()" 274 | }, 275 | "->toBeNan()": { 276 | "scope": "php", 277 | "prefix": ":pextobenan", 278 | "body": [ 279 | "->toBeNan();\n"], 280 | "description": "Pest ->toBeNan()" 281 | }, 282 | "->toBeNull()": { 283 | "scope": "php", 284 | "prefix": ":pextobenull", 285 | "body": [ 286 | "->toBeNull();\n"], 287 | "description": "Pest ->toBeNull()" 288 | }, 289 | "->toHaveKey()": { 290 | "scope": "php", 291 | "prefix": ":pextohavekey", 292 | "body": [ 293 | "->toHaveKey(${1:});\n"], 294 | "description": "Pest ->toHaveKey()" 295 | }, 296 | "->toHaveKeys()": { 297 | "scope": "php", 298 | "prefix": ":pextohavekeys", 299 | "body": [ 300 | "->toHaveKeys(${1:});\n"], 301 | "description": "Pest ->toHaveKeys()" 302 | }, 303 | "->toHaveLength()": { 304 | "scope": "php", 305 | "prefix": ":pextohavelength", 306 | "body": [ 307 | "->toHaveLength();\n"], 308 | "description": "Pest ->toHaveLength()" 309 | }, 310 | "->toBeDirectory": { 311 | "scope": "php", 312 | "prefix": ":pextobedirectory", 313 | "body": [ 314 | "->toBeDirectory();\n"], 315 | "description": "Pest ->toBeDirectory" 316 | }, 317 | "->toBeReadableDirectory": { 318 | "scope": "php", 319 | "prefix": ":pextobereadabledirectory", 320 | "body": [ 321 | "->toBeReadableDirectory();\n"], 322 | "description": "Pest ->toBeReadableDirectory" 323 | }, 324 | "->toBeReadableFile": { 325 | "scope": "php", 326 | "prefix": ":pextobereadablefile", 327 | "body": [ 328 | "->toBeReadableFile();\n"], 329 | "description": "Pest ->toBeReadableFile" 330 | }, 331 | "->toBeWritableDirectory()": { 332 | "scope": "php", 333 | "prefix": ":pextobewritabledirectory", 334 | "body": [ 335 | "->toBeWritableDirectory();\n"], 336 | "description": "Pest ->toBeWritableDirectory()" 337 | }, 338 | "->toBeWritableFile()": { 339 | "scope": "php", 340 | "prefix": ":pextobewritablefile", 341 | "body": [ 342 | "->toBeWritableFile();\n"], 343 | "description": "Pest ->toBeWritableFile()" 344 | }, 345 | "->toStartWith()": { 346 | "scope": "php", 347 | "prefix": ":pextostartwith", 348 | "body": [ 349 | "->toStartWith(${1:});\n"], 350 | "description": "Pest ->toStartWith()" 351 | }, 352 | "->toEndWith()": { 353 | "scope": "php", 354 | "prefix": ":pextoendwith", 355 | "body": [ 356 | "->toEndWith(${1:});\n"], 357 | "description": "Pest ->toEndWith()" 358 | }, 359 | "->toMatch()": { 360 | "scope": "php", 361 | "prefix": ":pextomatch", 362 | "body": [ 363 | "->toMatch(${1:});\n"], 364 | "description": "Pest ->toMatch()" 365 | }, 366 | "->toThrow()": { 367 | "scope": "php", 368 | "prefix": ":pextothrow", 369 | "body": [ 370 | "->toThrow(${1:});\n"], 371 | "description": "Pest ->toThrow()" 372 | }, 373 | "->toMatchConstraint()": { 374 | "scope": "php", 375 | "prefix": ":pextomatchconstraint", 376 | "body": [ 377 | "->toMatchConstraint(${1:});\n"], 378 | "description": "Pest ->toMatchConstraint()" 379 | }, 380 | " ->json()": { 381 | "scope": "php", 382 | "prefix": ":pexjson", 383 | "body": [ 384 | "->json()->\n"], 385 | "description": "Pest ->json()->" 386 | }, 387 | "->match()": { 388 | "scope": "php", 389 | "prefix": ":pexmatch", 390 | "body": [ 391 | "->match()->\n"], 392 | "description": "Pest ->match()->" 393 | }, 394 | "->dd()": { 395 | "scope": "php", 396 | "prefix": ":pexdd", 397 | "body": [ 398 | "->dd();\n"], 399 | "description": "Pest ->dd()" 400 | }, 401 | "->ray()": { 402 | "scope": "php", 403 | "prefix": ":pexray", 404 | "body": [ 405 | "->ray();\n"], 406 | "description": "Pest ->ray()" 407 | }, 408 | "->and()": { 409 | "scope": "php", 410 | "prefix": ":pexand", 411 | "body": [ 412 | "->and(${1:})->\n"], 413 | "description": "Pest ->and()->" 414 | }, 415 | "->not->": { 416 | "scope": "php", 417 | "prefix": ":pexnot", 418 | "body": [ 419 | "->not->\n"], 420 | "description": "Pest ->not->" 421 | }, 422 | "->defer()": { 423 | "scope": "php", 424 | "prefix": ":pexdef", 425 | "body": [ 426 | "->defer(${1:})->\n"], 427 | "description": "Pest ->tap()->" 428 | }, 429 | "->each()": { 430 | "scope": "php", 431 | "prefix": ":pexeach", 432 | "body": [ 433 | "->each(${1:})->\n"], 434 | "description": "Pest ->each()->" 435 | }, 436 | "->sequence()": { 437 | "scope": "php", 438 | "prefix": ":pexsequence", 439 | "body": [ 440 | "->sequence(${1:});\n"], 441 | "description": "Pest ->sequence()" 442 | }, 443 | "->when()": { 444 | "scope": "php", 445 | "prefix": ":pexwhen", 446 | "body": [ 447 | "->when(${1:});\n"], 448 | "description": "Pest ->when()" 449 | }, 450 | "->unless()": { 451 | "scope": "php", 452 | "prefix": ":pexunless", 453 | "body": [ 454 | "->unless(${1:});\n"], 455 | "description": "Pest ->unless()" 456 | } 457 | } -------------------------------------------------------------------------------- /snippets/snippets.json: -------------------------------------------------------------------------------- 1 | { 2 | "PestTestFunction": { 3 | "scope": "php", 4 | "prefix": ":pte", 5 | "body": [ 6 | "test('${1:}', function () {", " //expect(${2:})->", "});\n" 7 | ], 8 | "description": "Pest test()" 9 | }, 10 | "PestItFunction": { 11 | "scope": "php", 12 | "prefix": ":pit", 13 | "body": [ 14 | "it('${1:}', function () {", " //expect(${2:})->", "});\n" 15 | ], 16 | "description": "Pest it()" 17 | }, 18 | "PestTestThrows": { 19 | "scope": "php", 20 | "prefix": ":ptet", 21 | "body": [ 22 | "test('${1:}', function () {", " //expect(${2:})->", "})->throws();\n" 23 | ], 24 | "description": "Pest test()->throws()" 25 | }, 26 | "PestItThrows": { 27 | "scope": "php", 28 | "prefix": ":pitt", 29 | "body": [ 30 | "it('${1:}', function () {", " //expect(${2:})->", "})->throws();\n" 31 | ], 32 | "description": "Pest it()->throws(fn() =>)" 33 | }, 34 | "PestTestThrowsIf": { 35 | "scope": "php", 36 | "prefix": ":ptetif", 37 | "body": [ 38 | "test('${1:}', function () {", " //expect(${2:})->", "})->throwsIf(fn() => true);\n" 39 | ], 40 | "description": "Pest test()->throwsIf(fn() => true)" 41 | }, 42 | "PestItThrowsIf": { 43 | "scope": "php", 44 | "prefix": ":pittif", 45 | "body": [ 46 | "it('${1:}', function () {", " //expect(${2:})->", "})->throwsIf(fn() => true);\n" 47 | ], 48 | "description": "Pest it()->throwsIf(fn() => true)" 49 | }, 50 | "PestTestthrowsNoExceptions": { 51 | "scope": "php", 52 | "prefix": ":penoex", 53 | "body": [ 54 | "test('${1:}', function () {", " //expect(${2:})->", "})->throwsNoExceptions();\n" 55 | ], 56 | "description": "Pest test()->throwsNoExceptions()" 57 | }, 58 | "PestItthrowsNoExceptions": { 59 | "scope": "php", 60 | "prefix": ":pitnoex", 61 | "body": [ 62 | "it('${1:}', function () {", " //expect(${2:})->", "})->throwsNoExceptions();\n" 63 | ], 64 | "description": "Pest it()->throwsNoExceptions()" 65 | }, 66 | "PestTestFunctionWithSkip": { 67 | "scope": "php", 68 | "prefix": ":ptes", 69 | "body": [ 70 | "test('${1:}', function () {", " //expect(${2:})->", "})->skip();\n" 71 | ], 72 | "description": "Pest test() with Skip" 73 | }, 74 | "PestItFunctionWithSkip": { 75 | "scope": "php", 76 | "prefix": ":pits", 77 | "body": [ 78 | "it('${1:}', function () {", " //expect(${2:})->", "})->skip();\n" 79 | ], 80 | "description": "Pest it() with Skip" 81 | }, 82 | "PestTestFunctionWithSkipWip": { 83 | "scope": "php", 84 | "prefix": ":ptewip", 85 | "body": [ 86 | "test('${1:}', function () {", " //expect(${2:})->", "})->skip('wip');\n" 87 | ], 88 | "description": "Pest test() with Skip('wip')" 89 | }, 90 | "PestItFunctionWithSkipWip": { 91 | "scope": "php", 92 | "prefix": ":pitwip", 93 | "body": [ 94 | "it('${1:}', function () {", " //expect(${2:})->", "})->skip('wip');\n" 95 | ], 96 | "description": "Pest it() with Skip('wip')" 97 | }, 98 | "PestTestFunctionWithTodo": { 99 | "scope": "php", 100 | "prefix": ":petodo", 101 | "body": [ 102 | "test('${1:}', function () {", " //expect(${2:})->", "})->todo();\n" 103 | ], 104 | "description": "Pest test() with Todo" 105 | }, 106 | "PestItFunctionWithTodo": { 107 | "scope": "php", 108 | "prefix": ":pitodo", 109 | "body": [ 110 | "it('${1:}', function () {", " //expect(${2:})->", "})->todo();\n" 111 | ], 112 | "description": "Pest it() with Todo" 113 | }, 114 | "PestTestFunctionWithGroup": { 115 | "scope": "php", 116 | "prefix": ":pteg", 117 | "body": [ 118 | "test('${1:}', function () {", " //expect(${2:})->", "})->group(${3:});\n" 119 | ], 120 | "description": "Pest test() with Group" 121 | }, 122 | "PestItFunctionWithGroup": { 123 | "scope": "php", 124 | "prefix": ":pitg", 125 | "body": [ 126 | "it('${1:}', function () {", " //expect(${2:})->", "})->group(${3:});\n" 127 | ], 128 | "description": "Pest it() with Group" 129 | }, 130 | "PestTestFunctionWithDataset": { 131 | "scope": "php", 132 | "prefix": ":pted", 133 | "body": [ 134 | "test('${1:}', function () {", " //expect(${2:})->", "})->with([${3:}]);\n" 135 | ], 136 | "description": "Pest test() with Dataset" 137 | }, 138 | "PestItFunctionWithDataset": { 139 | "scope": "php", 140 | "prefix": ":pitd", 141 | "body": [ 142 | "it('${1:}', function () {", " //expect(${2:})->", "})->with([${3:}]);\n" 143 | ], 144 | "description": "Pest it() with Dataset" 145 | }, 146 | "PestTestFunctionWithLazyDataset": { 147 | "scope": "php", 148 | "prefix": ":pteld", 149 | "body": [ 150 | "test('${1:}', function () {", " //expect(${2:})->", "})->with(function () {", " yield '${3:}';", "});\n" 151 | ], 152 | "description": "Pest it() with Lazy Dataset" 153 | }, 154 | "PestItFunctionWithLazyDataset": { 155 | "scope": "php", 156 | "prefix": ":pitld", 157 | "body": [ 158 | "it('${1:}', function () {", " //expect(${2:})->", "})->with(function () {", " yield '${3:}';", "});\n" 159 | ], 160 | "description": "Pest it() with Lazy Dataset" 161 | }, 162 | "PestBeforeEach": { 163 | "scope": "php", 164 | "prefix": ":pbe", 165 | "body": [ 166 | "beforeEach(function () {", " //...${1:}", "});\n" 167 | ], 168 | "description": "Pest beforeEach()" 169 | }, 170 | "beforeAll": { 171 | "scope": "php", 172 | "prefix": ":pba", 173 | "body": [ 174 | "beforeAll(function () {", " //...${1:}", "});\n" 175 | ], 176 | "description": "Pest beforeAll()" 177 | }, 178 | "afterEach": { 179 | "scope": "php", 180 | "prefix": ":pae", 181 | "body": [ 182 | "afterEach(function () {", " //...${1:}", "});\n" 183 | ], 184 | "description": "Pest afterEach()" 185 | }, 186 | "afterAll": { 187 | "scope": "php", 188 | "prefix": ":paa", 189 | "body": [ 190 | "afterAll(function () {", " //...${1:}", "});\n" 191 | ], 192 | "description": "Pest afterAll()" 193 | } 194 | } --------------------------------------------------------------------------------