Skip to content

Instantly share code, notes, and snippets.

@dr41d45
Created March 10, 2023 14:54
Show Gist options
  • Save dr41d45/089f9d9ba1fff717876ab28e268b2ff7 to your computer and use it in GitHub Desktop.
Save dr41d45/089f9d9ba1fff717876ab28e268b2ff7 to your computer and use it in GitHub Desktop.
defstudio.code-snippets
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
// Snippets for the Pest Laravel Expectations Plugin of DefStudio
// Plugin is powered by https://github.com/defstudio
// Plugin is available at https://marketplace.visualstudio.com/items?itemName=defstudio.pest-plugin
// Snippets generated by github.com/dr41d45
// Snippets are available at
{
"Pest\\Exp.toBeAbleTo": {
"scope": "php",
"prefix": "toBeAbleTo()",
"body": [
"toBeAbleTo($1)$2"
],
"description": "Assert that the given User is authorized to do something."
},
"Pest\\Exp.toBeAuthenticated": {
"scope": "php",
"prefix": "toBeAuthenticated()",
"body": [
"toBeAuthenticated($1)$2"
],
"description": "Assert that the given User is authenticated."
},
"Pest\\Exp.toBeInvalidCredentials": {
"scope": "php",
"prefix": "toBeInvalidCredentials()",
"body": [
"toBeInvalidCredentials($1)$2"
],
"description": "Assert that the given credentials are invalid."
},
"Pest\\Exp.toBeValidCredentials": {
"scope": "php",
"prefix": "toBeValidCredentials()",
"body": [
"toBeValidCredentials($1)$2"
],
"description": "Assert that the given credentials are valid."
},
"Pest\\Exp.toBeCollection": {
"scope": "php",
"prefix": "toBeCollection()",
"body": [
"toBeCollection($1)$2"
],
"description": "Assert that the value is an instance of \\Illuminate\\Support\\Collection."
},
"Pest\\Exp.toBeEloquentCollection": {
"scope": "php",
"prefix": "toBeEloquentCollection()",
"body": [
"toBeEloquentCollection($1)$2"
],
"description": "Assert that the value is an instance of \\Illuminate\\Database\\Eloquent\\Collection."
},
"Pest\\Exp.toBeInDatabase": {
"scope": "php",
"prefix": "toBeInDatabase()",
"body": [
"toBeInDatabase($1)$2"
],
"description": "Assert that the given _where condition_ exists in the database."
},
"Pest\\Exp.toMatchQuery": {
"scope": "php",
"prefix": "toMatchQuery()",
"body": [
"toMatchQuery($1)$2"
],
"description": "Assert that sql query\/bindings match with the one generated by the ones generated by the given query builder"
},
"Pest\\Exp.toBeDeleted": {
"scope": "php",
"prefix": "toBeDeleted()",
"body": [
"toBeDeleted($1)$2"
],
"description": "Assert the given model to be deleted."
},
"Pest\\Exp.toBelongTo": {
"scope": "php",
"prefix": "toBelongTo()",
"body": [
"toBelongTo($1)$2"
],
"description": "Assert the given model belongs to another one."
},
"Pest\\Exp.toBeSameModelAs": {
"scope": "php",
"prefix": "toBeSameModelAs()",
"body": [
"toBeSameModelAs($1)$2"
],
"description": "Assert that the given model has the same ID and belong to the same table of another model."
},
"Pest\\Exp.toBeSoftDeleted": {
"scope": "php",
"prefix": "toBeSoftDeleted()",
"body": [
"toBeSoftDeleted($1)$2"
],
"description": "Assert the given model to be soft deleted."
},
"Pest\\Exp.toExist": {
"scope": "php",
"prefix": "toExist()",
"body": [
"toExist($1)$2"
],
"description": "Assert the given model exists in the database."
},
"Pest\\Exp.toOwn": {
"scope": "php",
"prefix": "toOwn()",
"body": [
"toOwn($1)$2"
],
"description": "Assert the given model owns child model."
},
"Pest\\Exp.toBeDownload": {
"scope": "php",
"prefix": "toBeDownload()",
"body": [
"toBeDownload($1)$2"
],
"description": "Assert that the response offers a file download."
},
"Pest\\Exp.toBeForbidden": {
"scope": "php",
"prefix": "toBeForbidden()",
"body": [
"toBeForbidden($1)$2"
],
"description": "Assert that the response has a forbidden status code."
},
"Pest\\Exp.toBeNotFound": {
"scope": "php",
"prefix": "toBeNotFound()",
"body": [
"toBeNotFound($1)$2"
],
"description": "Assert that the response has a not found status code."
},
"Pest\\Exp.toBeOk": {
"scope": "php",
"prefix": "toBeOk()",
"body": [
"toBeOk($1)$2"
],
"description": "Assert that the response has a 200 status code."
},
"Pest\\Exp.toBeRedirect": {
"scope": "php",
"prefix": "toBeRedirect()",
"body": [
"toBeRedirect($1)$2"
],
"description": "Assert that the response is a redirection."
},
"Pest\\Exp.toBeRedirectToSignedRoute": {
"scope": "php",
"prefix": "toBeRedirectToSignedRoute()",
"body": [
"toBeRedirectToSignedRoute($1)$2"
],
"description": "Assert whether the response is redirecting to a given signed route."
},
"Pest\\Exp.toBeSuccessful": {
"scope": "php",
"prefix": "toBeSuccessful()",
"body": [
"toBeSuccessful($1)$2"
],
"description": "Assert that the response has a successful status code."
},
"Pest\\Exp.toBeUnauthorized": {
"scope": "php",
"prefix": "toBeUnauthorized()",
"body": [
"toBeUnauthorized($1)$2"
],
"description": "Assert that the response has an unauthorized status code."
},
"Pest\\Exp.toConfirmCreation": {
"scope": "php",
"prefix": "toConfirmCreation()",
"body": [
"toConfirmCreation($1)$2"
],
"description": "Assert that the response has a 201 status code."
},
"Pest\\Exp.toContainText": {
"scope": "php",
"prefix": "toContainText()",
"body": [
"toContainText($1)$2"
],
"description": "alias for [`toRenderText()`](expectations\/responses#torendertext)"
},
"Pest\\Exp.toRenderText": {
"scope": "php",
"prefix": "toRenderText()",
"body": [
"toRenderText($1)$2"
],
"description": "Assert that the response contains the given string or array of strings in its text."
},
"Pest\\Exp.toContainTextInOrder": {
"scope": "php",
"prefix": "toContainTextInOrder()",
"body": [
"toContainTextInOrder($1)$2"
],
"description": "alias for [`toRenderTextInOrder()`](expectations\/responses#torendertextinorder)"
},
"Pest\\Exp.toRenderTextInOrder": {
"scope": "php",
"prefix": "toRenderTextInOrder()",
"body": [
"toRenderTextInOrder($1)$2"
],
"description": "Assert that the response contains the given ordered sequence of strings in its text."
},
"Pest\\Exp.toHaveAllSession": {
"scope": "php",
"prefix": "toHaveAllSession()",
"body": [
"toHaveAllSession($1)$2"
],
"description": "Assert that the session has a given list of values."
},
"Pest\\Exp.toHaveHeader": {
"scope": "php",
"prefix": "toHaveHeader()",
"body": [
"toHaveHeader($1)$2"
],
"description": "Assert that the response contains the given header and equals the optional value."
},
"Pest\\Exp.toHaveInvalid": {
"scope": "php",
"prefix": "toHaveInvalid()",
"body": [
"toHaveInvalid($1)$2"
],
"description": "Assert that the response has the given validation error keys."
},
"Pest\\Exp.toHaveLocation": {
"scope": "php",
"prefix": "toHaveLocation()",
"body": [
"toHaveLocation($1)$2"
],
"description": "Assert that the current location header matches the given URI."
},
"Pest\\Exp.toHaveMissingHeader": {
"scope": "php",
"prefix": "toHaveMissingHeader()",
"body": [
"toHaveMissingHeader($1)$2"
],
"description": "Assert that the response does not contain the given header."
},
"Pest\\Exp.toHaveNoContent": {
"scope": "php",
"prefix": "toHaveNoContent()",
"body": [
"toHaveNoContent($1)$2"
],
"description": "Assert that the response has the given status code and no content."
},
"Pest\\Exp.toHaveSession": {
"scope": "php",
"prefix": "toHaveSession()",
"body": [
"toHaveSession($1)$2"
],
"description": "Assert that the session has a given value."
},
"Pest\\Exp.toHaveStatus": {
"scope": "php",
"prefix": "toHaveStatus()",
"body": [
"toHaveStatus($1)$2"
],
"description": "Assert that the response has the given status code."
},
"Pest\\Exp.toHaveValid": {
"scope": "php",
"prefix": "toHaveValid()",
"body": [
"toHaveValid($1)$2"
],
"description": "Assert that the response doesn't have the given validation error keys."
},
"Pest\\Exp.toHaveExactJson": {
"scope": "php",
"prefix": "toHaveExactJson()",
"body": [
"toHaveExactJson($1)$2"
],
"description": "Assert that the response has the exact given JSON."
},
"Pest\\Exp.toHaveJson": {
"scope": "php",
"prefix": "toHaveJson()",
"body": [
"toHaveJson($1)$2"
],
"description": "Assert that the response is a superset of the given JSON."
},
"Pest\\Exp.toHaveJsonFragment": {
"scope": "php",
"prefix": "toHaveJsonFragment()",
"body": [
"toHaveJsonFragment($1)$2"
],
"description": "Assert that the response contains the given JSON fragment."
},
"Pest\\Exp.toHaveJsonPath": {
"scope": "php",
"prefix": "toHaveJsonPath()",
"body": [
"toHaveJsonPath($1)$2"
],
"description": "Assert that the expected value and type exists at the given path in the response."
},
"Pest\\Exp.toHaveJsonStructure": {
"scope": "php",
"prefix": "toHaveJsonStructure()",
"body": [
"toHaveJsonStructure($1)$2"
],
"description": "Assert that the response has a given JSON structure."
},
"Pest\\Exp.toHaveJsonValidationErrors": {
"scope": "php",
"prefix": "toHaveJsonValidationErrors()",
"body": [
"toHaveJsonValidationErrors($1)$2"
],
"description": "Assert that the response has the given JSON validation errors."
},
"Pest\\Exp.toRender": {
"scope": "php",
"prefix": "toRender()",
"body": [
"toRender($1)$2"
],
"description": "Assert that the response contains the given string or array of strings."
},
"Pest\\Exp.toRenderInOrder": {
"scope": "php",
"prefix": "toRenderInOrder()",
"body": [
"toRenderInOrder($1)$2"
],
"description": "Assert that the response contains the given ordered sequence of strings."
},
"Pest\\Exp.toExistInStorage": {
"scope": "php",
"prefix": "toExistInStorage()",
"body": [
"toExistInStorage($1)$2"
],
"description": "Assert that the given file exist in storage."
},
"Pest\\Exp.toBeMissingInStorage": {
"scope": "php",
"prefix": "toBeMissingInStorage()",
"body": [
"toBeMissingInStorage($1)$2"
],
"description": "Assert that the given file does not exist in storage."
},
"Pest\\Exp.toBeAfter": {
"scope": "php",
"prefix": "toBeAfter()",
"body": [
"toBeAfter($1)$2"
],
"description": "Assert the date is after the given one."
},
"Pest\\Exp.toBeBefore": {
"scope": "php",
"prefix": "toBeBefore()",
"body": [
"toBeBefore($1)$2"
],
"description": "Assert the date is before the given one."
},
"Pest\\Exp.toBeBetween": {
"scope": "php",
"prefix": "toBeBetween()",
"body": [
"toBeBetween($1)$2"
],
"description": "Assert the date is between the given ones."
},
"Pest\\Exp.toBeBirthday": {
"scope": "php",
"prefix": "toBeBirthday()",
"body": [
"toBeBirthday($1)$2"
],
"description": "Assert the date a birthday."
},
"Pest\\Exp.toBeCurrentDay": {
"scope": "php",
"prefix": "toBeCurrentDay()",
"body": [
"toBeCurrentDay($1)$2"
],
"description": "```php"
},
"Pest\\Exp.toBeCurrentHour": {
"scope": "php",
"prefix": "toBeCurrentHour()",
"body": [
"toBeCurrentHour($1)$2"
],
"description": "Assert the date is in the current hour."
},
"Pest\\Exp.toBeCurrentMinute": {
"scope": "php",
"prefix": "toBeCurrentMinute()",
"body": [
"toBeCurrentMinute($1)$2"
],
"description": "Assert the date is in the current minute."
},
"Pest\\Exp.toBeCurrentMonth": {
"scope": "php",
"prefix": "toBeCurrentMonth()",
"body": [
"toBeCurrentMonth($1)$2"
],
"description": "Assert the date is in the current month."
},
"Pest\\Exp.toBeCurrentSecond": {
"scope": "php",
"prefix": "toBeCurrentSecond()",
"body": [
"toBeCurrentSecond($1)$2"
],
"description": "Assert the date is in the current second."
},
"Pest\\Exp.toBeCurrentWeek": {
"scope": "php",
"prefix": "toBeCurrentWeek()",
"body": [
"toBeCurrentWeek($1)$2"
],
"description": "Assert the date is in the current week."
},
"Pest\\Exp.toBeCurrentYear": {
"scope": "php",
"prefix": "toBeCurrentYear()",
"body": [
"toBeCurrentYear($1)$2"
],
"description": "Assert the date is in the current year."
},
"Pest\\Exp.toBeEndOfDay": {
"scope": "php",
"prefix": "toBeEndOfDay()",
"body": [
"toBeEndOfDay($1)$2"
],
"description": "Assert the date is end of day."
},
"Pest\\Exp.toBeFuture": {
"scope": "php",
"prefix": "toBeFuture()",
"body": [
"toBeFuture($1)$2"
],
"description": "Assert the date is in the future."
},
"Pest\\Exp.toBeFriday": {
"scope": "php",
"prefix": "toBeFriday()",
"body": [
"toBeFriday($1)$2"
],
"description": "Assert the date is Friday."
},
"Pest\\Exp.toBeLastMonth": {
"scope": "php",
"prefix": "toBeLastMonth()",
"body": [
"toBeLastMonth($1)$2"
],
"description": "Assert the date is in the last month."
},
"Pest\\Exp.toBeLastWeek": {
"scope": "php",
"prefix": "toBeLastWeek()",
"body": [
"toBeLastWeek($1)$2"
],
"description": "Assert the date is in the last week."
},
"Pest\\Exp.toBeLastYear": {
"scope": "php",
"prefix": "toBeLastYear()",
"body": [
"toBeLastYear($1)$2"
],
"description": "Assert the date is in the last year."
},
"Pest\\Exp.toBeMidday": {
"scope": "php",
"prefix": "toBeMidday()",
"body": [
"toBeMidday($1)$2"
],
"description": "Assert the date is midday."
},
"Pest\\Exp.toBeMidnight": {
"scope": "php",
"prefix": "toBeMidnight()",
"body": [
"toBeMidnight($1)$2"
],
"description": "Assert the date is start of day \/ midnight."
},
"Pest\\Exp.toBeMonday": {
"scope": "php",
"prefix": "toBeMonday()",
"body": [
"toBeMonday($1)$2"
],
"description": "Assert the date is Monday."
},
"Pest\\Exp.toBeNextMonth": {
"scope": "php",
"prefix": "toBeNextMonth()",
"body": [
"toBeNextMonth($1)$2"
],
"description": "Assert the date is in the next month."
},
"Pest\\Exp.toBeNextWeek": {
"scope": "php",
"prefix": "toBeNextWeek()",
"body": [
"toBeNextWeek($1)$2"
],
"description": "Assert the date is in the next week."
},
"Pest\\Exp.toBeNextYear": {
"scope": "php",
"prefix": "toBeNextYear()",
"body": [
"toBeNextYear($1)$2"
],
"description": "Assert the date is in the next year."
},
"Pest\\Exp.toBePast": {
"scope": "php",
"prefix": "toBePast()",
"body": [
"toBePast($1)$2"
],
"description": "Assert the date is in the past."
},
"Pest\\Exp.toBeSameDayAs": {
"scope": "php",
"prefix": "toBeSameDayAs()",
"body": [
"toBeSameDayAs($1)$2"
],
"description": "Assert the date is the same day as the given one."
},
"Pest\\Exp.toBeSameHourAs": {
"scope": "php",
"prefix": "toBeSameHourAs()",
"body": [
"toBeSameHourAs($1)$2"
],
"description": "Assert the date is the same hour as the given one."
},
"Pest\\Exp.toBeSameMinuteAs": {
"scope": "php",
"prefix": "toBeSameMinuteAs()",
"body": [
"toBeSameMinuteAs($1)$2"
],
"description": "Assert the date is the same minute as the given one."
},
"Pest\\Exp.toBeSameMonthAs": {
"scope": "php",
"prefix": "toBeSameMonthAs()",
"body": [
"toBeSameMonthAs($1)$2"
],
"description": "Assert the date is the same hour as the given one."
},
"Pest\\Exp.toBeSameSecondAs": {
"scope": "php",
"prefix": "toBeSameSecondAs()",
"body": [
"toBeSameSecondAs($1)$2"
],
"description": "Assert the date is the same second as the given one."
},
"Pest\\Exp.toBeSameYearAs": {
"scope": "php",
"prefix": "toBeSameYearAs()",
"body": [
"toBeSameYearAs($1)$2"
],
"description": "Assert the date is the same year as the given one."
},
"Pest\\Exp.toBeSameWeekAs": {
"scope": "php",
"prefix": "toBeSameWeekAs()",
"body": [
"toBeSameWeekAs($1)$2"
],
"description": "Assert the date is the same week as the given one."
},
"Pest\\Exp.toBeSaturday": {
"scope": "php",
"prefix": "toBeSaturday()",
"body": [
"toBeSaturday($1)$2"
],
"description": "Assert the date is Saturday."
},
"Pest\\Exp.toBeStartOfDay": {
"scope": "php",
"prefix": "toBeStartOfDay()",
"body": [
"toBeStartOfDay($1)$2"
],
"description": "Assert the date is start of day \/ midnight."
},
"Pest\\Exp.toBeSunday": {
"scope": "php",
"prefix": "toBeSunday()",
"body": [
"toBeSunday($1)$2"
],
"description": "Assert the date is Sunday."
},
"Pest\\Exp.toBeToday": {
"scope": "php",
"prefix": "toBeToday()",
"body": [
"toBeToday($1)$2"
],
"description": "alias for [`toBeCurrentDay()`](expectations\/time#tobecurrentday)"
},
"Pest\\Exp.toBeTomorrow": {
"scope": "php",
"prefix": "toBeTomorrow()",
"body": [
"toBeTomorrow($1)$2"
],
"description": "Assert the date is tomorrow."
},
"Pest\\Exp.toBeTuesday": {
"scope": "php",
"prefix": "toBeTuesday()",
"body": [
"toBeTuesday($1)$2"
],
"description": "Assert the date is Tuesday."
},
"Pest\\Exp.toBeThursday": {
"scope": "php",
"prefix": "toBeThursday()",
"body": [
"toBeThursday($1)$2"
],
"description": "Assert the date is Thursday."
},
"Pest\\Exp.toBeWeekday": {
"scope": "php",
"prefix": "toBeWeekday()",
"body": [
"toBeWeekday($1)$2"
],
"description": "Assert the date is a weekday (between monday and friday)."
},
"Pest\\Exp.toBeWeekend": {
"scope": "php",
"prefix": "toBeWeekend()",
"body": [
"toBeWeekend($1)$2"
],
"description": "Assert the date is Saturday or Sunday."
},
"Pest\\Exp.toBeWednesday": {
"scope": "php",
"prefix": "toBeWednesday()",
"body": [
"toBeWednesday($1)$2"
],
"description": "Assert the date is Wednesday."
},
"Pest\\Exp.toBeYesterday": {
"scope": "php",
"prefix": "toBeYesterday()",
"body": [
"toBeYesterday($1)$2"
],
"description": "Assert the date is yesterday."
},
"Pest\\Exp.toBeView": {
"scope": "php",
"prefix": "toBeView()",
"body": [
"toBeView($1)$2"
],
"description": "Assert that the value is an instance of \\Illuminate\\View\\View with the given name."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment