plozmun / behat-faker-extension
Behat Faker 扩展
0.2.3
2022-01-24 18:37 UTC
Requires
- php: ^7.2| ^8.0
- behat/behat: ^3.10
- fakerphp/faker: ^1.17
- symfony/expression-language: ^4.4|^5.4|^6.0
Requires (Dev)
- phpstan/phpstan: ^1.4
- squizlabs/php_codesniffer: ^3.6
README
Faker PHP 与 Behat Gherkin 语言的集成
安装
- 使用 Composer 安装此扩展
composer require --dev plozmun/behat-faker-extension
- 在 Behat 配置中启用它
# behat.yaml.dist / behat.yaml default: extensions: Plozmun\FakerExtension: locale: 'es_es' # Optional to enable locale functions
用法
在括号中添加您的 PHP Faker 函数
例如:{{firstName}}
或复杂函数 {{dateTimeBetween('-5 years', '-1 years').format('Y-m-d')}}
Feature: Create a Book In order to create a new book As a admin user I need to be able to create a book Scenario: Send post to create a new book When I add "Content-Type" header equal to "application/json" When I send a "POST" request to "/api/v1/book/{{ean13}}" with body: """ { "author": { "firsName": "{{firstName}}", "lastName": "{{lastName}}" }, "title": "{{sentence}}", "createdAt": "{{dateTimeInInterval('-5 years', '-1 years').format('Y-m-d')}} } """ And the response status code should be 200 Scenario: Show published books Given the following products exist: | ean | title | | {{ean}} | {{sentence}} | | {{ean}} | {{sentence}} | When I go to "/admin/books"
贡献者
Pablo Lozano - plozmun [主要开发者]