Skip to content

Commit

Permalink
[shopsys] markdown unordered lists are now formatted logically (#3622)
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmannmartin authored Nov 27, 2024
1 parent 67c4c70 commit 8d23b50
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,39 +103,39 @@ To change this behavior you must implement method `customizeRouteConfigs(RouteCo

[`RouteConfigCustomizer`](./src/RouteConfigCustomizer.php) provides two methods for customizing individual route requests:

- `customize` accepts callback `function (RouteConfig $config, RouteInfo $info) {...}` as the only argument.
This is called with each [`RouteConfig`](./src/RouteConfig.php) along with [`RouteInfo`](./src/RouteInfo.php) collected from your router.
This method is useful when you want to define general rules for multiple routes (eg. skip all routes with name starting with underscore).
- `customizeByRouteName` accepts a single route name or an array of route names as the first argument and same callback as `customize` as the second argument.
This is called with each [`RouteConfig`](./src/RouteConfig.php) along with [`RouteInfo`](./src/RouteInfo.php) with matching route name.
If matching route config is not found a [`RouteNameNotFoundException`](./src/Exception/RouteNameNotFoundException.php) is thrown.
This method is useful when you want to define rules for specific routes (eg. logging in to some secured route).
- `customize` accepts callback `function (RouteConfig $config, RouteInfo $info) {...}` as the only argument.
This is called with each [`RouteConfig`](./src/RouteConfig.php) along with [`RouteInfo`](./src/RouteInfo.php) collected from your router.
This method is useful when you want to define general rules for multiple routes (eg. skip all routes with name starting with underscore).
- `customizeByRouteName` accepts a single route name or an array of route names as the first argument and same callback as `customize` as the second argument.
This is called with each [`RouteConfig`](./src/RouteConfig.php) along with [`RouteInfo`](./src/RouteInfo.php) with matching route name.
If matching route config is not found a [`RouteNameNotFoundException`](./src/Exception/RouteNameNotFoundException.php) is thrown.
This method is useful when you want to define rules for specific routes (eg. logging in to some secured route).

In your customizing callback you can call three methods on [`RouteConfig`](./src/RouteConfig.php) to change the tested behavior:

- `skipRoute` can be called to skip this route during test.
- `changeDefaultRequestDataSet` is the main method for configuring routes.
It returns [`RequestDataSet`](./src/RequestDataSet.php) object offering the setters needed to change the actual behavior:
- `setExpectedStatusCode` changes the expected response HTTP status code that will be asserted.
- `setAuth` changes the authentication method for the route.
(Use [`NoAuth`](./src/Auth/NoAuth.php) for anonymous access, [`BasicHttpAuth`](./src/Auth/BasicHttpAuth.php) for logging in via basic http headers
or implement your own method using [`AuthInterface`](./src/Auth/AuthInterface.php).)
- `setParameter` specifies value of a route parameter by name.
- `addCallDuringTestExecution` adds a callback `function (RequestDataSet $requestDataSet, ContainerInterface $container) { ... }` to be called before test execution.
(Useful for code that needs to access the same instance of container as the test method, eg. adding CSRF token as a route parameter)
- `addExtraRequestDataSet` can be used to test more requests on the same route (eg. test a secured route as both logged in and anonymous user).
Returns [`RequestDataSet`](./src/RequestDataSet.php) that you can use the same way as the result from `changeDefaultRequestDataSet`.
All configured options will extend the values from default request data set (even when you change the default [`RequestDataSet`](./src/RequestDataSet.php) after you add the extra [`RequestDataSet`](./src/RequestDataSet.php)).
- `skipRoute` can be called to skip this route during test.
- `changeDefaultRequestDataSet` is the main method for configuring routes.
It returns [`RequestDataSet`](./src/RequestDataSet.php) object offering the setters needed to change the actual behavior:
- `setExpectedStatusCode` changes the expected response HTTP status code that will be asserted.
- `setAuth` changes the authentication method for the route.
(Use [`NoAuth`](./src/Auth/NoAuth.php) for anonymous access, [`BasicHttpAuth`](./src/Auth/BasicHttpAuth.php) for logging in via basic http headers
or implement your own method using [`AuthInterface`](./src/Auth/AuthInterface.php).)
- `setParameter` specifies value of a route parameter by name.
- `addCallDuringTestExecution` adds a callback `function (RequestDataSet $requestDataSet, ContainerInterface $container) { ... }` to be called before test execution.
(Useful for code that needs to access the same instance of container as the test method, eg. adding CSRF token as a route parameter)
- `addExtraRequestDataSet` can be used to test more requests on the same route (eg. test a secured route as both logged in and anonymous user).
Returns [`RequestDataSet`](./src/RequestDataSet.php) that you can use the same way as the result from `changeDefaultRequestDataSet`.
All configured options will extend the values from default request data set (even when you change the default [`RequestDataSet`](./src/RequestDataSet.php) after you add the extra [`RequestDataSet`](./src/RequestDataSet.php)).

_Note: All three methods of [`RouteConfigCustomizer`](./src/RouteConfigCustomizer.php) accept `string $debugNote` as an argument._
_It is useful for describing the reasons of your configuration change because it may help you with debugging when the test fails._

Additionally you can override these methods in your implementation of [`HttpSmokeTestCase`](./src/HttpSmokeTestCase.php) to further change the test behavior:

- `setUp` to change the way your kernel is booted (eg. boot it with different options).
- `getRouterAdapter` to change the object responsible for collecting routes from your application and generating urls.
- `createRequest` if you have specific needs about the way `Request` is created from [`RequestDataSet`](./src/RequestDataSet.php).
- `handleRequest` to customize handling `Request` in your application (eg. you can wrap it in database transaction to roll it back into original state).
- `setUp` to change the way your kernel is booted (eg. boot it with different options).
- `getRouterAdapter` to change the object responsible for collecting routes from your application and generating urls.
- `createRequest` if you have specific needs about the way `Request` is created from [`RequestDataSet`](./src/RequestDataSet.php).
- `handleRequest` to customize handling `Request` in your application (eg. you can wrap it in database transaction to roll it back into original state).

### Annotations

Expand All @@ -151,9 +151,9 @@ Used for setting expected status code based on provided paramteters.
})
```

- arguments:
- `parameters` _(optional)_
- `statusCode` _(optional, default = `200`)_
- arguments:
- `parameters` _(optional)_
- `statusCode` _(optional, default = `200`)_

#### Parameter

Expand All @@ -163,9 +163,9 @@ Parameter defines value for specified parameter.
@Parameter(name="name", value="Batman")
```

- arguments:
- `name` _(required)_
- `value` _(required)_
- arguments:
- `name` _(required)_
- `value` _(required)_

#### Skipped

Expand Down

0 comments on commit 8d23b50

Please sign in to comment.