From 628fbc9b15672c5cc9be49bac288a02e2691b3a0 Mon Sep 17 00:00:00 2001 From: Ilyar Date: Wed, 16 Jan 2019 17:50:03 +0200 Subject: [PATCH] =?UTF-8?q?feat(dredd):=20add=20sample=20for=20Dredd=20?= =?UTF-8?q?=E2=80=94=20php-silex?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dredd/php-silex/.gitignore | 1 + dredd/php-silex/.travis.yml | 5 + dredd/php-silex/api-description.yml | 25 ++ dredd/php-silex/composer.json | 11 + dredd/php-silex/composer.lock | 623 ++++++++++++++++++++++++++++ dredd/php-silex/dredd.yml | 34 ++ dredd/php-silex/index.php | 14 + dredd/php-silex/readme.md | 8 + dredd/readme.md | 1 + 9 files changed, 722 insertions(+) create mode 100644 dredd/php-silex/.gitignore create mode 100644 dredd/php-silex/.travis.yml create mode 100644 dredd/php-silex/api-description.yml create mode 100644 dredd/php-silex/composer.json create mode 100644 dredd/php-silex/composer.lock create mode 100644 dredd/php-silex/dredd.yml create mode 100644 dredd/php-silex/index.php create mode 100644 dredd/php-silex/readme.md diff --git a/dredd/php-silex/.gitignore b/dredd/php-silex/.gitignore new file mode 100644 index 0000000..22d0d82 --- /dev/null +++ b/dredd/php-silex/.gitignore @@ -0,0 +1 @@ +vendor diff --git a/dredd/php-silex/.travis.yml b/dredd/php-silex/.travis.yml new file mode 100644 index 0000000..5d5ad70 --- /dev/null +++ b/dredd/php-silex/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +before_install: + - npm install dredd@5.3.0 --no-optional --global +before_script: + - dredd diff --git a/dredd/php-silex/api-description.yml b/dredd/php-silex/api-description.yml new file mode 100644 index 0000000..a7f27e1 --- /dev/null +++ b/dredd/php-silex/api-description.yml @@ -0,0 +1,25 @@ +swagger: "2.0" +info: + version: "1.0" + title: Example API + license: + name: MIT +host: www.example.com +basePath: / +schemes: + - http +paths: + /: + get: + produces: + - application/json; charset=utf-8 + responses: + 200: + description: "" + schema: + type: object + properties: + message: + type: string + required: + - message diff --git a/dredd/php-silex/composer.json b/dredd/php-silex/composer.json new file mode 100644 index 0000000..c7aa630 --- /dev/null +++ b/dredd/php-silex/composer.json @@ -0,0 +1,11 @@ +{ + "name": "dredd-php-silex", + "version": "1.0.0", + "description": "Sample dredd via silex", + "require": { + "silex/silex": "~1.2" + }, + "require-dev": { + "ddelnano/dredd-hooks-php": "^1.1" + } +} diff --git a/dredd/php-silex/composer.lock b/dredd/php-silex/composer.lock new file mode 100644 index 0000000..10f7a60 --- /dev/null +++ b/dredd/php-silex/composer.lock @@ -0,0 +1,623 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "c8d63819023834838e9bd3e3ee5734b5", + "packages": [ + { + "name": "pimple/pimple", + "version": "v1.1.1", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/2019c145fe393923f3441b23f29bbdfaa5c58c4d", + "reference": "2019c145fe393923f3441b23f29bbdfaa5c58c4d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2013-11-22T08:30:29+00:00" + }, + { + "name": "psr/log", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "silex/silex", + "version": "v1.3.6", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Silex.git", + "reference": "ff8aa6bc2e066e14b07e0c63e9bd9dd1458af136" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Silex/zipball/ff8aa6bc2e066e14b07e0c63e9bd9dd1458af136", + "reference": "ff8aa6bc2e066e14b07e0c63e9bd9dd1458af136", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "pimple/pimple": "~1.0", + "symfony/event-dispatcher": "~2.3|3.0.*", + "symfony/http-foundation": "~2.3|3.0.*", + "symfony/http-kernel": "~2.3|3.0.*", + "symfony/routing": "~2.3|3.0.*" + }, + "require-dev": { + "doctrine/dbal": "~2.2", + "monolog/monolog": "^1.4.1", + "swiftmailer/swiftmailer": "~5", + "symfony/browser-kit": "~2.3|3.0.*", + "symfony/config": "~2.3|3.0.*", + "symfony/css-selector": "~2.3|3.0.*", + "symfony/debug": "~2.3|3.0.*", + "symfony/dom-crawler": "~2.3|3.0.*", + "symfony/finder": "~2.3|3.0.*", + "symfony/form": "~2.3|3.0.*", + "symfony/intl": "~2.3|3.0.*", + "symfony/monolog-bridge": "~2.3|3.0.*", + "symfony/options-resolver": "~2.3|3.0.*", + "symfony/phpunit-bridge": "~2.7", + "symfony/process": "~2.3|3.0.*", + "symfony/security": "~2.3|3.0.*", + "symfony/serializer": "~2.3|3.0.*", + "symfony/translation": "~2.3|3.0.*", + "symfony/twig-bridge": "~2.3|3.0.*", + "symfony/validator": "~2.3|3.0.*", + "twig/twig": "~1.28|~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Silex\\": "src/Silex" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "The PHP micro-framework based on the Symfony Components", + "homepage": "http://silex.sensiolabs.org", + "keywords": [ + "microframework" + ], + "abandoned": "symfony/flex", + "time": "2017-04-30T16:26:54+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.4.19", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/2016b3eec2e49c127dd02d0ef44a35c53181560d", + "reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T19:48:54+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "54da3ff63dec3c9c0e32ec3f95a7d94ef64baa00" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/54da3ff63dec3c9c0e32ec3f95a7d94ef64baa00", + "reference": "54da3ff63dec3c9c0e32ec3f95a7d94ef64baa00", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2016-07-19T10:44:15+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "49ba00f8ede742169cb6b70abe33243f4d673f82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/49ba00f8ede742169cb6b70abe33243f4d673f82", + "reference": "49ba00f8ede742169cb6b70abe33243f4d673f82", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "symfony/expression-language": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2016-07-17T13:54:30+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "d97ba4425e36e79c794e7d14ff36f00f081b37b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/d97ba4425e36e79c794e7d14ff36f00f081b37b3", + "reference": "d97ba4425e36e79c794e7d14ff36f00f081b37b3", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0", + "symfony/debug": "~2.8|~3.0", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/http-foundation": "~2.8.8|~3.0.8|~3.1.2|~3.2" + }, + "conflict": { + "symfony/config": "<2.8" + }, + "require-dev": { + "symfony/browser-kit": "~2.8|~3.0", + "symfony/class-loader": "~2.8|~3.0", + "symfony/config": "~2.8|~3.0", + "symfony/console": "~2.8|~3.0", + "symfony/css-selector": "~2.8|~3.0", + "symfony/dependency-injection": "~2.8|~3.0", + "symfony/dom-crawler": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/finder": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0", + "symfony/routing": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0", + "symfony/templating": "~2.8|~3.0", + "symfony/translation": "~2.8|~3.0", + "symfony/var-dumper": "~2.8|~3.0" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/class-loader": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/finder": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2016-07-30T09:10:37+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.10.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-09-21T13:07:52+00:00" + }, + { + "name": "symfony/routing", + "version": "v3.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "9038984bd9c05ab07280121e9e10f61a7231457b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/9038984bd9c05ab07280121e9e10f61a7231457b", + "reference": "9038984bd9c05ab07280121e9e10f61a7231457b", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "conflict": { + "symfony/config": "<2.8" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "doctrine/common": "~2.2", + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0", + "symfony/expression-language": "~2.8|~3.0", + "symfony/http-foundation": "~2.8|~3.0", + "symfony/yaml": "~2.8|~3.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/dependency-injection": "For loading routes from a service", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2016-06-29T05:40:00+00:00" + } + ], + "packages-dev": [ + { + "name": "ddelnano/dredd-hooks-php", + "version": "1.1.6", + "source": { + "type": "git", + "url": "https://github.com/ddelnano/dredd-hooks-php.git", + "reference": "89ac3d4a738cbad090aaf5f1f1c5297e14d61a63" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ddelnano/dredd-hooks-php/zipball/89ac3d4a738cbad090aaf5f1f1c5297e14d61a63", + "reference": "89ac3d4a738cbad090aaf5f1f1c5297e14d61a63", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "require-dev": { + "mockery/mockery": "0.9.*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "^2.5" + }, + "bin": [ + "bin/dredd-hooks-php" + ], + "type": "library", + "autoload": { + "psr-4": { + "Dredd\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Domenic Del Nano", + "email": "ddelnano@gmail.com" + } + ], + "description": "PHP hooks for the Dredd testing tool", + "homepage": "https://github.com/ddelnano/dredd-hooks-php/wiki", + "keywords": [ + "dredd" + ], + "time": "2018-09-24T12:37:02+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": [], + "platform-dev": [] +} diff --git a/dredd/php-silex/dredd.yml b/dredd/php-silex/dredd.yml new file mode 100644 index 0000000..0e088af --- /dev/null +++ b/dredd/php-silex/dredd.yml @@ -0,0 +1,34 @@ +dry-run: null +hookfiles: null +language: php +sandbox: false +server: 'php -S 127.0.0.1:3000' +server-wait: 3 +init: false +custom: {} +names: false +only: [] +reporter: apiary +output: [] +header: [] +sorted: false +user: null +inline-errors: false +details: false +method: [] +color: true +level: info +timestamp: false +silent: false +path: [] +hooks-worker-timeout: 5000 +hooks-worker-connect-timeout: 1500 +hooks-worker-connect-retry: 500 +hooks-worker-after-connect-wait: 100 +hooks-worker-term-timeout: 5000 +hooks-worker-term-retry: 500 +hooks-worker-handler-host: 127.0.0.1 +hooks-worker-handler-port: 61321 +config: ./dredd.yml +blueprint: api-description.yml +endpoint: 'http://127.0.0.1:3000' diff --git a/dredd/php-silex/index.php b/dredd/php-silex/index.php new file mode 100644 index 0000000..b5acd77 --- /dev/null +++ b/dredd/php-silex/index.php @@ -0,0 +1,14 @@ +GET('/', function () { + return new Response('How about implementing rootGet as a GET method ?'); +}); + +$app->run(); diff --git a/dredd/php-silex/readme.md b/dredd/php-silex/readme.md new file mode 100644 index 0000000..61ec1bd --- /dev/null +++ b/dredd/php-silex/readme.md @@ -0,0 +1,8 @@ +# Dredd — HTTP API Testing Framework (php-silex) + +```bash +npm install +npm test +``` + +https://dredd.readthedocs.io/en/latest/hooks-php.html diff --git a/dredd/readme.md b/dredd/readme.md index 27a5ab5..eb63194 100644 --- a/dredd/readme.md +++ b/dredd/readme.md @@ -3,3 +3,4 @@ ## Samples - [nodejs-express](nodejs-express) +- [php-silex](php-silex)