Initial commit
This commit is contained in:
commit
64bb788110
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
.idea
|
||||
composer.phar
|
||||
|
||||
clover.xml
|
||||
coveralls-upload.json
|
||||
phpunit.xml
|
||||
vendor/
|
||||
46
bin/clear-config-cache.php
Normal file
46
bin/clear-config-cache.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* Script for clearing the configuration cache.
|
||||
*
|
||||
* Can also be invoked as `composer clear-config-cache`.
|
||||
*
|
||||
* @see https://github.com/zendframework/zend-expressive-skeleton for the canonical source repository
|
||||
* @copyright Copyright (c) 2017 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license https://github.com/zendframework/zend-expressive-skeleton/blob/master/LICENSE.md New BSD License
|
||||
*/
|
||||
|
||||
chdir(__DIR__ . '/../');
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$config = include 'config/config.php';
|
||||
|
||||
if (! isset($config['config_cache_path'])) {
|
||||
echo "No configuration cache path found" . PHP_EOL;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (! file_exists($config['config_cache_path'])) {
|
||||
printf(
|
||||
"Configured config cache file '%s' not found%s",
|
||||
$config['config_cache_path'],
|
||||
PHP_EOL
|
||||
);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (false === unlink($config['config_cache_path'])) {
|
||||
printf(
|
||||
"Error removing config cache file '%s'%s",
|
||||
$config['config_cache_path'],
|
||||
PHP_EOL
|
||||
);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
printf(
|
||||
"Removed configured config cache file '%s'%s",
|
||||
$config['config_cache_path'],
|
||||
PHP_EOL
|
||||
);
|
||||
exit(0);
|
||||
59
composer.json
Normal file
59
composer.json
Normal file
@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "zendframework/zend-expressive-skeleton",
|
||||
"description": "Zend expressive skeleton. Begin developing PSR-7 middleware applications in seconds!",
|
||||
"type": "project",
|
||||
"homepage": "https://github.com/zendframework/zend-expressive-skeleton",
|
||||
"license": "BSD-3-Clause",
|
||||
"config": {
|
||||
"sort-packages": true
|
||||
},
|
||||
"require": {
|
||||
"php": "^5.6 || ^7.0",
|
||||
"imagine/imagine": "^0.7.1",
|
||||
"roave/security-advisories": "dev-master",
|
||||
"symfony/yaml": "*",
|
||||
"zendframework/zend-component-installer": "^1.0",
|
||||
"zendframework/zend-config": "*",
|
||||
"zendframework/zend-config-aggregator": "^1.0",
|
||||
"zendframework/zend-expressive": "^2.0.2",
|
||||
"zendframework/zend-expressive-fastroute": "^2.0",
|
||||
"zendframework/zend-expressive-helpers": "^4.0",
|
||||
"zendframework/zend-servicemanager": "^3.3",
|
||||
"zendframework/zend-stdlib": "^3.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^6.0.8 || ^5.7.15",
|
||||
"squizlabs/php_codesniffer": "^2.8.1",
|
||||
"zfcampus/zf-development-mode": "^3.1",
|
||||
"filp/whoops": "^2.1.7"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "src/App/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"AppTest\\": "test/AppTest/"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"post-create-project-cmd": [
|
||||
"@development-enable"
|
||||
],
|
||||
"development-disable": "zf-development-mode disable",
|
||||
"development-enable": "zf-development-mode enable",
|
||||
"development-status": "zf-development-mode status",
|
||||
"check": [
|
||||
"@cs-check",
|
||||
"@test"
|
||||
],
|
||||
"clear-config-cache": "php bin/clear-config-cache.php",
|
||||
"cs-check": "phpcs",
|
||||
"cs-fix": "phpcbf",
|
||||
"serve": "php -S 0.0.0.0:8080 -t public public/index.php",
|
||||
"test": "phpunit --colors=always",
|
||||
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
|
||||
"upload-coverage": "coveralls -v"
|
||||
}
|
||||
}
|
||||
2940
composer.lock
generated
Normal file
2940
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
config/.gitignore
vendored
Normal file
1
config/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
development.config.php
|
||||
2
config/autoload/.gitignore
vendored
Normal file
2
config/autoload/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
local.php
|
||||
*.local.php
|
||||
39
config/autoload/dependencies.global.php
Normal file
39
config/autoload/dependencies.global.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use Zend\Expressive\Application;
|
||||
use Zend\Expressive\Container;
|
||||
use Zend\Expressive\Delegate;
|
||||
use Zend\Expressive\Helper;
|
||||
use Zend\Expressive\Middleware;
|
||||
|
||||
return [
|
||||
// Provides application-wide services.
|
||||
// We recommend using fully-qualified class names whenever possible as
|
||||
// service names.
|
||||
'dependencies' => [
|
||||
// Use 'aliases' to alias a service name to another service. The
|
||||
// key is the alias name, the value is the service to which it points.
|
||||
'aliases' => [
|
||||
'Zend\Expressive\Delegate\DefaultDelegate' => Delegate\NotFoundDelegate::class,
|
||||
],
|
||||
// Use 'invokables' for constructor-less services, or services that do
|
||||
// not require arguments to the constructor. Map a service name to the
|
||||
// class name.
|
||||
'invokables' => [
|
||||
// Fully\Qualified\InterfaceName::class => Fully\Qualified\ClassName::class,
|
||||
Helper\ServerUrlHelper::class => Helper\ServerUrlHelper::class,
|
||||
],
|
||||
// Use 'factories' for services provided by callbacks/factory classes.
|
||||
'factories' => [
|
||||
Application::class => Container\ApplicationFactory::class,
|
||||
Delegate\NotFoundDelegate::class => Container\NotFoundDelegateFactory::class,
|
||||
Helper\ServerUrlMiddleware::class => Helper\ServerUrlMiddlewareFactory::class,
|
||||
Helper\UrlHelper::class => Helper\UrlHelperFactory::class,
|
||||
Helper\UrlHelperMiddleware::class => Helper\UrlHelperMiddlewareFactory::class,
|
||||
|
||||
Zend\Stratigility\Middleware\ErrorHandler::class => Container\ErrorHandlerFactory::class,
|
||||
Middleware\ErrorResponseGenerator::class => Container\ErrorResponseGeneratorFactory::class,
|
||||
Middleware\NotFoundHandler::class => Container\NotFoundHandlerFactory::class,
|
||||
],
|
||||
],
|
||||
];
|
||||
34
config/autoload/development.local.php.dist
Normal file
34
config/autoload/development.local.php.dist
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Development-only configuration.
|
||||
*
|
||||
* Put settings you want enabled when under development mode in this file, and
|
||||
* check it into your repository.
|
||||
*
|
||||
* Developers on your team will then automatically enable them by calling on
|
||||
* `composer development-enable`.
|
||||
*/
|
||||
|
||||
use Zend\Expressive\Container;
|
||||
use Zend\Expressive\Middleware\ErrorResponseGenerator;
|
||||
|
||||
return [
|
||||
'dependencies' => [
|
||||
'invokables' => [
|
||||
],
|
||||
'factories' => [
|
||||
ErrorResponseGenerator::class => Container\WhoopsErrorResponseGeneratorFactory::class,
|
||||
'Zend\Expressive\Whoops' => Container\WhoopsFactory::class,
|
||||
'Zend\Expressive\WhoopsPageHandler' => Container\WhoopsPageHandlerFactory::class,
|
||||
],
|
||||
],
|
||||
|
||||
'whoops' => [
|
||||
'json_exceptions' => [
|
||||
'display' => true,
|
||||
'show_trace' => true,
|
||||
'ajax_only' => true,
|
||||
],
|
||||
],
|
||||
];
|
||||
11
config/autoload/local.php.dist
Normal file
11
config/autoload/local.php.dist
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Local configuration.
|
||||
*
|
||||
* Copy this file to `local.php` and change its settings as required.
|
||||
* `local.php` is ignored by git and safe to use for local and sensitive data like usernames and passwords.
|
||||
*/
|
||||
|
||||
return [
|
||||
];
|
||||
12
config/autoload/router.global.php
Normal file
12
config/autoload/router.global.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
use Zend\Expressive\Router\FastRouteRouter;
|
||||
use Zend\Expressive\Router\RouterInterface;
|
||||
|
||||
return [
|
||||
'dependencies' => [
|
||||
'invokables' => [
|
||||
RouterInterface::class => FastRouteRouter::class,
|
||||
],
|
||||
],
|
||||
];
|
||||
27
config/autoload/zend-expressive.global.php
Normal file
27
config/autoload/zend-expressive.global.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
use Zend\ConfigAggregator\ConfigAggregator;
|
||||
|
||||
return [
|
||||
// Toggle the configuration cache. Set this to boolean false, or remove the
|
||||
// directive, to disable configuration caching. Toggling development mode
|
||||
// will also disable it by default; clear the configuration cache using
|
||||
// `composer clear-config-cache`.
|
||||
ConfigAggregator::ENABLE_CACHE => true,
|
||||
|
||||
// Enable debugging; typically used to provide debugging information within templates.
|
||||
'debug' => false,
|
||||
|
||||
'zend-expressive' => [
|
||||
// Enable programmatic pipeline: Any `middleware_pipeline` or `routes`
|
||||
// configuration will be ignored when creating the `Application` instance.
|
||||
'programmatic_pipeline' => true,
|
||||
|
||||
// Provide templates for the error handling middleware to use when
|
||||
// generating responses.
|
||||
'error_handler' => [
|
||||
'template_404' => 'error::404',
|
||||
'template_error' => 'error::error',
|
||||
],
|
||||
],
|
||||
];
|
||||
32
config/config.php
Normal file
32
config/config.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Zend\ConfigAggregator\ArrayProvider;
|
||||
use Zend\ConfigAggregator\ConfigAggregator;
|
||||
use Zend\ConfigAggregator\PhpFileProvider;
|
||||
|
||||
// To enable or disable caching, set the `ConfigAggregator::ENABLE_CACHE` boolean in
|
||||
// `config/autoload/local.php`.
|
||||
$cacheConfig = [
|
||||
'config_cache_path' => 'data/config-cache.php',
|
||||
];
|
||||
|
||||
$aggregator = new ConfigAggregator([
|
||||
// Include cache configuration
|
||||
new ArrayProvider($cacheConfig),
|
||||
|
||||
// Default App module config
|
||||
App\ConfigProvider::class,
|
||||
|
||||
// Load application config in a pre-defined order in such a way that local settings
|
||||
// overwrite global settings. (Loaded as first to last):
|
||||
// - `global.php`
|
||||
// - `*.global.php`
|
||||
// - `local.php`
|
||||
// - `*.local.php`
|
||||
new PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
|
||||
|
||||
// Load development config if it exists
|
||||
new PhpFileProvider('config/development.config.php'),
|
||||
], $cacheConfig['config_cache_path']);
|
||||
|
||||
return $aggregator->getMergedConfig();
|
||||
16
config/container.php
Normal file
16
config/container.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Zend\ServiceManager\Config;
|
||||
use Zend\ServiceManager\ServiceManager;
|
||||
|
||||
// Load configuration
|
||||
$config = require __DIR__ . '/config.php';
|
||||
|
||||
// Build container
|
||||
$container = new ServiceManager();
|
||||
(new Config($config['dependencies']))->configureServiceManager($container);
|
||||
|
||||
// Inject config
|
||||
$container->setService('config', $config);
|
||||
|
||||
return $container;
|
||||
29
config/development.config.php.dist
Normal file
29
config/development.config.php.dist
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* File required to allow enablement of development mode.
|
||||
*
|
||||
* For use with the zf-development-mode tool.
|
||||
*
|
||||
* Usage:
|
||||
* $ composer development-disable
|
||||
* $ composer development-enable
|
||||
* $ composer development-status
|
||||
*
|
||||
* DO NOT MODIFY THIS FILE.
|
||||
*
|
||||
* Provide your own development-mode settings by editing the file
|
||||
* `config/autoload/development.local.php.dist`.
|
||||
*
|
||||
* Because this file is aggregated last, it simply ensures:
|
||||
*
|
||||
* - The `debug` flag is _enabled_.
|
||||
* - Configuration caching is _disabled_.
|
||||
*/
|
||||
|
||||
use Zend\ConfigAggregator\ConfigAggregator;
|
||||
|
||||
return [
|
||||
'debug' => true,
|
||||
ConfigAggregator::ENABLE_CACHE => false,
|
||||
];
|
||||
55
config/pipeline.php
Normal file
55
config/pipeline.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
use Zend\Expressive\Helper\ServerUrlMiddleware;
|
||||
use Zend\Expressive\Helper\UrlHelperMiddleware;
|
||||
use Zend\Expressive\Middleware\ImplicitHeadMiddleware;
|
||||
use Zend\Expressive\Middleware\ImplicitOptionsMiddleware;
|
||||
use Zend\Expressive\Middleware\NotFoundHandler;
|
||||
use Zend\Stratigility\Middleware\ErrorHandler;
|
||||
|
||||
/**
|
||||
* Setup middleware pipeline:
|
||||
*/
|
||||
|
||||
// The error handler should be the first (most outer) middleware to catch
|
||||
// all Exceptions.
|
||||
$app->pipe(ErrorHandler::class);
|
||||
$app->pipe(ServerUrlMiddleware::class);
|
||||
|
||||
// Pipe more middleware here that you want to execute on every request:
|
||||
// - bootstrapping
|
||||
// - pre-conditions
|
||||
// - modifications to outgoing responses
|
||||
//
|
||||
// Piped Middleware may be either callables or service names. Middleware may
|
||||
// also be passed as an array; each item in the array must resolve to
|
||||
// middleware eventually (i.e., callable or service name).
|
||||
//
|
||||
// Middleware can be attached to specific paths, allowing you to mix and match
|
||||
// applications under a common domain. The handlers in each middleware
|
||||
// attached this way will see a URI with the MATCHED PATH SEGMENT REMOVED!!!
|
||||
//
|
||||
// - $app->pipe('/api', $apiMiddleware);
|
||||
// - $app->pipe('/docs', $apiDocMiddleware);
|
||||
// - $app->pipe('/files', $filesMiddleware);
|
||||
|
||||
// Register the routing middleware in the middleware pipeline
|
||||
$app->pipeRoutingMiddleware();
|
||||
$app->pipe(ImplicitHeadMiddleware::class);
|
||||
$app->pipe(ImplicitOptionsMiddleware::class);
|
||||
$app->pipe(UrlHelperMiddleware::class);
|
||||
|
||||
// Add more middleware here that needs to introspect the routing results; this
|
||||
// might include:
|
||||
//
|
||||
// - route-based authentication
|
||||
// - route-based validation
|
||||
// - etc.
|
||||
|
||||
// Register the dispatch middleware in the middleware pipeline
|
||||
$app->pipeDispatchMiddleware();
|
||||
|
||||
// At this point, if no Response is return by any middleware, the
|
||||
// NotFoundHandler kicks in; alternately, you can provide other fallback
|
||||
// middleware to execute.
|
||||
$app->pipe(NotFoundHandler::class);
|
||||
33
config/routes.php
Normal file
33
config/routes.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Setup routes with a single request method:
|
||||
*
|
||||
* $app->get('/', App\Action\HomePageAction::class, 'home');
|
||||
* $app->post('/album', App\Action\AlbumCreateAction::class, 'album.create');
|
||||
* $app->put('/album/:id', App\Action\AlbumUpdateAction::class, 'album.put');
|
||||
* $app->patch('/album/:id', App\Action\AlbumUpdateAction::class, 'album.patch');
|
||||
* $app->delete('/album/:id', App\Action\AlbumDeleteAction::class, 'album.delete');
|
||||
*
|
||||
* Or with multiple request methods:
|
||||
*
|
||||
* $app->route('/contact', App\Action\ContactAction::class, ['GET', 'POST', ...], 'contact');
|
||||
*
|
||||
* Or handling all request methods:
|
||||
*
|
||||
* $app->route('/contact', App\Action\ContactAction::class)->setName('contact');
|
||||
*
|
||||
* or:
|
||||
*
|
||||
* $app->route(
|
||||
* '/contact',
|
||||
* App\Action\ContactAction::class,
|
||||
* Zend\Expressive\Router\Route::HTTP_METHOD_ANY,
|
||||
* 'contact'
|
||||
* );
|
||||
*/
|
||||
|
||||
$app->get('/', App\Action\HomePageAction::class, 'home');
|
||||
$app->get('/api/ping', App\Action\PingAction::class, 'api.ping');
|
||||
$app->get('/api/galleries', App\Action\ListGalleriesAction::class, 'api.galleries');
|
||||
$app->get('/api/gallery/{slug}', App\Action\ListGalleriesAction::class, 'api.gallery');
|
||||
$app->get('/api/image/{slug}/{image}[/thumb]', App\Action\GetImageAction::class, 'api.image');
|
||||
2
data/.gitignore
vendored
Normal file
2
data/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*
|
||||
!.gitignore
|
||||
52
deploy.php
Normal file
52
deploy.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
require 'recipe/common.php';
|
||||
|
||||
server('prod', 'woody.fixnet.hu', 22)
|
||||
->user('yvan')
|
||||
->forwardAgent() // You can use identity key, ssh config, or username/password to auth on the server.
|
||||
->stage('production')
|
||||
->env('deploy_path', '/mnt/domains/yvan.hu/photos/api');
|
||||
|
||||
set('repository', 'gitosis@git.fixnet.hu:angullary.git');
|
||||
|
||||
set('shared_files', [
|
||||
'vendor',
|
||||
'data/galleries',
|
||||
'config/autoload/local.php',
|
||||
]);
|
||||
|
||||
task('npm:install', function () {
|
||||
cd('{{release_path}}/module/AngularFrontend');
|
||||
run('npm install || exit 0');
|
||||
});
|
||||
|
||||
task('deploy:clean', [
|
||||
'deploy:prepare',
|
||||
'deploy:release',
|
||||
'deploy:update_code',
|
||||
'deploy:shared',
|
||||
'deploy:vendors',
|
||||
'deploy:symlink',
|
||||
'cleanup',
|
||||
]);
|
||||
|
||||
task('deploy', [
|
||||
'deploy:prepare',
|
||||
'deploy:release',
|
||||
'deploy:update_code',
|
||||
'deploy:shared',
|
||||
'deploy:symlink',
|
||||
'npm:install',
|
||||
'cleanup',
|
||||
]);
|
||||
|
||||
/*
|
||||
task('php5-fpm:reload', function () {
|
||||
run('sudo service php5-fpm reload');
|
||||
});
|
||||
|
||||
after('deploy', 'php5-fpm:reload');
|
||||
after('deploy:clean', 'php5-fpm:reload');
|
||||
after('rollback', 'php5-fpm:reload');
|
||||
*/
|
||||
542
package-lock.json
generated
Normal file
542
package-lock.json
generated
Normal file
@ -0,0 +1,542 @@
|
||||
{
|
||||
"requires": true,
|
||||
"lockfileVersion": 1,
|
||||
"dependencies": {
|
||||
"abbrev": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz",
|
||||
"integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8="
|
||||
},
|
||||
"accepts": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.3.tgz",
|
||||
"integrity": "sha1-w8p0NJOGSMPg2cHjKN1otiLChMo=",
|
||||
"requires": {
|
||||
"mime-types": "2.1.15",
|
||||
"negotiator": "0.6.1"
|
||||
}
|
||||
},
|
||||
"amdefine": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
|
||||
"integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU="
|
||||
},
|
||||
"angular2-platform-node": {
|
||||
"version": "2.1.0-rc.1",
|
||||
"resolved": "https://registry.npmjs.org/angular2-platform-node/-/angular2-platform-node-2.1.0-rc.1.tgz",
|
||||
"integrity": "sha1-q5LQk5Uf/u3k8VcK7I3hpFS5FkU=",
|
||||
"requires": {
|
||||
"css": "2.2.1",
|
||||
"parse5": "2.2.3",
|
||||
"preboot": "4.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"preboot": {
|
||||
"version": "4.5.2",
|
||||
"resolved": "https://registry.npmjs.org/preboot/-/preboot-4.5.2.tgz",
|
||||
"integrity": "sha1-yzSSCZWMK0jX90E3s0mbu+VHKl4="
|
||||
}
|
||||
}
|
||||
},
|
||||
"angular2-universal": {
|
||||
"version": "2.1.0-rc.1",
|
||||
"resolved": "https://registry.npmjs.org/angular2-universal/-/angular2-universal-2.1.0-rc.1.tgz",
|
||||
"integrity": "sha1-jNX1KIAUsV2G6xiCnC9u8/hByAs=",
|
||||
"requires": {
|
||||
"angular2-platform-node": "2.1.0-rc.1",
|
||||
"css": "2.2.1",
|
||||
"js-beautify": "1.6.14",
|
||||
"parse5": "2.2.3",
|
||||
"preboot": "4.5.2",
|
||||
"xhr2": "0.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"preboot": {
|
||||
"version": "4.5.2",
|
||||
"resolved": "https://registry.npmjs.org/preboot/-/preboot-4.5.2.tgz",
|
||||
"integrity": "sha1-yzSSCZWMK0jX90E3s0mbu+VHKl4="
|
||||
}
|
||||
}
|
||||
},
|
||||
"array-flatten": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
|
||||
},
|
||||
"atob": {
|
||||
"version": "1.1.3",
|
||||
"resolved": "https://registry.npmjs.org/atob/-/atob-1.1.3.tgz",
|
||||
"integrity": "sha1-lfE2KbEsOlGl0hWr3OKqnzL4B3M="
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "3.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.0.tgz",
|
||||
"integrity": "sha1-eRQg1/VR7qKJdFOop3ZT+WYG1nw="
|
||||
},
|
||||
"body-parser": {
|
||||
"version": "1.17.2",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.17.2.tgz",
|
||||
"integrity": "sha1-+IkqvI+eYn1Crtr7yma/WrmRBO4=",
|
||||
"requires": {
|
||||
"bytes": "2.4.0",
|
||||
"content-type": "1.0.2",
|
||||
"debug": "2.6.7",
|
||||
"depd": "1.1.0",
|
||||
"http-errors": "1.6.1",
|
||||
"iconv-lite": "0.4.15",
|
||||
"on-finished": "2.3.0",
|
||||
"qs": "6.4.0",
|
||||
"raw-body": "2.2.0",
|
||||
"type-is": "1.6.15"
|
||||
}
|
||||
},
|
||||
"bytes": {
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/bytes/-/bytes-2.4.0.tgz",
|
||||
"integrity": "sha1-fZcZb51br39pNeJZhVSe3SpsIzk="
|
||||
},
|
||||
"commander": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz",
|
||||
"integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ=="
|
||||
},
|
||||
"config-chain": {
|
||||
"version": "1.1.11",
|
||||
"resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.11.tgz",
|
||||
"integrity": "sha1-q6CXR9++TD5w52am5BWG4YWfxvI=",
|
||||
"requires": {
|
||||
"ini": "1.3.4",
|
||||
"proto-list": "1.2.4"
|
||||
}
|
||||
},
|
||||
"content-disposition": {
|
||||
"version": "0.5.2",
|
||||
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz",
|
||||
"integrity": "sha1-DPaLud318r55YcOoUXjLhdunjLQ="
|
||||
},
|
||||
"content-type": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.2.tgz",
|
||||
"integrity": "sha1-t9ETrueo3Se9IRM8TcJSnfFyHu0="
|
||||
},
|
||||
"cookie": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.3.1.tgz",
|
||||
"integrity": "sha1-5+Ch+e9DtMi6klxcWpboBtFoc7s="
|
||||
},
|
||||
"cookie-signature": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
|
||||
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
|
||||
},
|
||||
"css": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/css/-/css-2.2.1.tgz",
|
||||
"integrity": "sha1-c6TIHehdtmTU7mdPfUcIXjstVdw=",
|
||||
"requires": {
|
||||
"inherits": "2.0.3",
|
||||
"source-map": "0.1.43",
|
||||
"source-map-resolve": "0.3.1",
|
||||
"urix": "0.1.0"
|
||||
}
|
||||
},
|
||||
"debug": {
|
||||
"version": "2.6.7",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.7.tgz",
|
||||
"integrity": "sha1-krrR9tBbu2u6Isyoi80OyJTChh4=",
|
||||
"requires": {
|
||||
"ms": "2.0.0"
|
||||
}
|
||||
},
|
||||
"depd": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.0.tgz",
|
||||
"integrity": "sha1-4b2Cxqq2ztlluXuIsX7T5SjKGMM="
|
||||
},
|
||||
"destroy": {
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
|
||||
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
|
||||
},
|
||||
"editorconfig": {
|
||||
"version": "0.13.2",
|
||||
"resolved": "https://registry.npmjs.org/editorconfig/-/editorconfig-0.13.2.tgz",
|
||||
"integrity": "sha1-jleSbZ7mmrbLmZ8CfCFxRnrM6zU=",
|
||||
"requires": {
|
||||
"bluebird": "3.5.0",
|
||||
"commander": "2.11.0",
|
||||
"lru-cache": "3.2.0",
|
||||
"sigmund": "1.0.1"
|
||||
}
|
||||
},
|
||||
"ee-first": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||
},
|
||||
"encodeurl": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.1.tgz",
|
||||
"integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA="
|
||||
},
|
||||
"escape-html": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
|
||||
},
|
||||
"etag": {
|
||||
"version": "1.8.0",
|
||||
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.0.tgz",
|
||||
"integrity": "sha1-b2Ma7zNtbEY2K1F2QETOIWvjwFE="
|
||||
},
|
||||
"express": {
|
||||
"version": "4.15.3",
|
||||
"resolved": "https://registry.npmjs.org/express/-/express-4.15.3.tgz",
|
||||
"integrity": "sha1-urZdDwOqgMNYQIly/HAPkWlEtmI=",
|
||||
"requires": {
|
||||
"accepts": "1.3.3",
|
||||
"array-flatten": "1.1.1",
|
||||
"content-disposition": "0.5.2",
|
||||
"content-type": "1.0.2",
|
||||
"cookie": "0.3.1",
|
||||
"cookie-signature": "1.0.6",
|
||||
"debug": "2.6.7",
|
||||
"depd": "1.1.0",
|
||||
"encodeurl": "1.0.1",
|
||||
"escape-html": "1.0.3",
|
||||
"etag": "1.8.0",
|
||||
"finalhandler": "1.0.3",
|
||||
"fresh": "0.5.0",
|
||||
"merge-descriptors": "1.0.1",
|
||||
"methods": "1.1.2",
|
||||
"on-finished": "2.3.0",
|
||||
"parseurl": "1.3.1",
|
||||
"path-to-regexp": "0.1.7",
|
||||
"proxy-addr": "1.1.4",
|
||||
"qs": "6.4.0",
|
||||
"range-parser": "1.2.0",
|
||||
"send": "0.15.3",
|
||||
"serve-static": "1.12.3",
|
||||
"setprototypeof": "1.0.3",
|
||||
"statuses": "1.3.1",
|
||||
"type-is": "1.6.15",
|
||||
"utils-merge": "1.0.0",
|
||||
"vary": "1.1.1"
|
||||
}
|
||||
},
|
||||
"finalhandler": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.0.3.tgz",
|
||||
"integrity": "sha1-70fneVDpmXgOhgIqVg4yF+DQzIk=",
|
||||
"requires": {
|
||||
"debug": "2.6.7",
|
||||
"encodeurl": "1.0.1",
|
||||
"escape-html": "1.0.3",
|
||||
"on-finished": "2.3.0",
|
||||
"parseurl": "1.3.1",
|
||||
"statuses": "1.3.1",
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"forwarded": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.0.tgz",
|
||||
"integrity": "sha1-Ge+YdMSuHCl7zweP3mOgm2aoQ2M="
|
||||
},
|
||||
"fresh": {
|
||||
"version": "0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.0.tgz",
|
||||
"integrity": "sha1-9HTKXmqSRtb9jglTz6m5yAWvp44="
|
||||
},
|
||||
"http-errors": {
|
||||
"version": "1.6.1",
|
||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.1.tgz",
|
||||
"integrity": "sha1-X4uO2YrKVFZWv1cplzh/kEpyIlc=",
|
||||
"requires": {
|
||||
"depd": "1.1.0",
|
||||
"inherits": "2.0.3",
|
||||
"setprototypeof": "1.0.3",
|
||||
"statuses": "1.3.1"
|
||||
}
|
||||
},
|
||||
"iconv-lite": {
|
||||
"version": "0.4.15",
|
||||
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.15.tgz",
|
||||
"integrity": "sha1-/iZaIYrGpXz+hUkn6dBMGYJe3es="
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
|
||||
"integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
|
||||
},
|
||||
"ini": {
|
||||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz",
|
||||
"integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4="
|
||||
},
|
||||
"ipaddr.js": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.3.0.tgz",
|
||||
"integrity": "sha1-HgOlL9rYOou7KyXL9JmLTP/NPew="
|
||||
},
|
||||
"js-beautify": {
|
||||
"version": "1.6.14",
|
||||
"resolved": "https://registry.npmjs.org/js-beautify/-/js-beautify-1.6.14.tgz",
|
||||
"integrity": "sha1-07j3Mi0CuSd9WL0jgmTDJ+WARM0=",
|
||||
"requires": {
|
||||
"config-chain": "1.1.11",
|
||||
"editorconfig": "0.13.2",
|
||||
"mkdirp": "0.5.1",
|
||||
"nopt": "3.0.6"
|
||||
}
|
||||
},
|
||||
"lru-cache": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-3.2.0.tgz",
|
||||
"integrity": "sha1-cXibO39Tmb7IVl3aOKow0qCX7+4=",
|
||||
"requires": {
|
||||
"pseudomap": "1.0.2"
|
||||
}
|
||||
},
|
||||
"media-typer": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
|
||||
},
|
||||
"merge-descriptors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
|
||||
},
|
||||
"methods": {
|
||||
"version": "1.1.2",
|
||||
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
|
||||
},
|
||||
"mime": {
|
||||
"version": "1.3.4",
|
||||
"resolved": "https://registry.npmjs.org/mime/-/mime-1.3.4.tgz",
|
||||
"integrity": "sha1-EV+eO2s9rylZmDyzjxSaLUDrXVM="
|
||||
},
|
||||
"mime-db": {
|
||||
"version": "1.27.0",
|
||||
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz",
|
||||
"integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE="
|
||||
},
|
||||
"mime-types": {
|
||||
"version": "2.1.15",
|
||||
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz",
|
||||
"integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=",
|
||||
"requires": {
|
||||
"mime-db": "1.27.0"
|
||||
}
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz",
|
||||
"integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0="
|
||||
},
|
||||
"mkdirp": {
|
||||
"version": "0.5.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz",
|
||||
"integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=",
|
||||
"requires": {
|
||||
"minimist": "0.0.8"
|
||||
}
|
||||
},
|
||||
"ms": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
|
||||
},
|
||||
"negotiator": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.1.tgz",
|
||||
"integrity": "sha1-KzJxhOiZIQEXeyhWP7XnECrNDKk="
|
||||
},
|
||||
"nopt": {
|
||||
"version": "3.0.6",
|
||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-3.0.6.tgz",
|
||||
"integrity": "sha1-xkZdvwirzU2zWTF/eaxopkayj/k=",
|
||||
"requires": {
|
||||
"abbrev": "1.1.0"
|
||||
}
|
||||
},
|
||||
"on-finished": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
|
||||
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
|
||||
"requires": {
|
||||
"ee-first": "1.1.1"
|
||||
}
|
||||
},
|
||||
"parse5": {
|
||||
"version": "2.2.3",
|
||||
"resolved": "https://registry.npmjs.org/parse5/-/parse5-2.2.3.tgz",
|
||||
"integrity": "sha1-DE/EHBAAxea5PUiwP4CDg3g06fY="
|
||||
},
|
||||
"parseurl": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.1.tgz",
|
||||
"integrity": "sha1-yKuMkiO6NIiKpkopeyiFO+wY2lY="
|
||||
},
|
||||
"path-to-regexp": {
|
||||
"version": "0.1.7",
|
||||
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
|
||||
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
|
||||
},
|
||||
"preboot": {
|
||||
"version": "5.0.0-rc.13",
|
||||
"resolved": "https://registry.npmjs.org/preboot/-/preboot-5.0.0-rc.13.tgz",
|
||||
"integrity": "sha512-SYmM7rlXBKVbb/Ncxh8D3NkYygEsZI1AacWWhIbcJP4/61Wkg8UhfaVCu/Rd8qEjNOhb4dxY3OOgoVPkifT6rA=="
|
||||
},
|
||||
"proto-list": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
|
||||
"integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk="
|
||||
},
|
||||
"proxy-addr": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-1.1.4.tgz",
|
||||
"integrity": "sha1-J+VF9pYKRKYn2bREZ+NcG2tM4vM=",
|
||||
"requires": {
|
||||
"forwarded": "0.1.0",
|
||||
"ipaddr.js": "1.3.0"
|
||||
}
|
||||
},
|
||||
"pseudomap": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
|
||||
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM="
|
||||
},
|
||||
"qs": {
|
||||
"version": "6.4.0",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz",
|
||||
"integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM="
|
||||
},
|
||||
"range-parser": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.0.tgz",
|
||||
"integrity": "sha1-9JvmtIeJTdxA3MlKMi9hEJLgDV4="
|
||||
},
|
||||
"raw-body": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.2.0.tgz",
|
||||
"integrity": "sha1-mUl2z2pQlqQRYoQEkvC9xdbn+5Y=",
|
||||
"requires": {
|
||||
"bytes": "2.4.0",
|
||||
"iconv-lite": "0.4.15",
|
||||
"unpipe": "1.0.0"
|
||||
}
|
||||
},
|
||||
"resolve-url": {
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
|
||||
"integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo="
|
||||
},
|
||||
"send": {
|
||||
"version": "0.15.3",
|
||||
"resolved": "https://registry.npmjs.org/send/-/send-0.15.3.tgz",
|
||||
"integrity": "sha1-UBP5+ZAj31DRvZiSwZ4979HVMwk=",
|
||||
"requires": {
|
||||
"debug": "2.6.7",
|
||||
"depd": "1.1.0",
|
||||
"destroy": "1.0.4",
|
||||
"encodeurl": "1.0.1",
|
||||
"escape-html": "1.0.3",
|
||||
"etag": "1.8.0",
|
||||
"fresh": "0.5.0",
|
||||
"http-errors": "1.6.1",
|
||||
"mime": "1.3.4",
|
||||
"ms": "2.0.0",
|
||||
"on-finished": "2.3.0",
|
||||
"range-parser": "1.2.0",
|
||||
"statuses": "1.3.1"
|
||||
}
|
||||
},
|
||||
"serve-static": {
|
||||
"version": "1.12.3",
|
||||
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.12.3.tgz",
|
||||
"integrity": "sha1-n0uhni8wMMVH+K+ZEHg47DjVseI=",
|
||||
"requires": {
|
||||
"encodeurl": "1.0.1",
|
||||
"escape-html": "1.0.3",
|
||||
"parseurl": "1.3.1",
|
||||
"send": "0.15.3"
|
||||
}
|
||||
},
|
||||
"setprototypeof": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.0.3.tgz",
|
||||
"integrity": "sha1-ZlZ+NwQ+608E2RvWWMDL77VbjgQ="
|
||||
},
|
||||
"sigmund": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz",
|
||||
"integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA="
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.1.43",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz",
|
||||
"integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=",
|
||||
"requires": {
|
||||
"amdefine": "1.0.1"
|
||||
}
|
||||
},
|
||||
"source-map-resolve": {
|
||||
"version": "0.3.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.3.1.tgz",
|
||||
"integrity": "sha1-YQ9hIqRFuN1RU1oqcbeD38Ekh2E=",
|
||||
"requires": {
|
||||
"atob": "1.1.3",
|
||||
"resolve-url": "0.2.1",
|
||||
"source-map-url": "0.3.0",
|
||||
"urix": "0.1.0"
|
||||
}
|
||||
},
|
||||
"source-map-url": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.3.0.tgz",
|
||||
"integrity": "sha1-fsrxO1e80J2opAxdJp2zN5nUqvk="
|
||||
},
|
||||
"statuses": {
|
||||
"version": "1.3.1",
|
||||
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.3.1.tgz",
|
||||
"integrity": "sha1-+vUbnrdKrvOzrPStX2Gr8ky3uT4="
|
||||
},
|
||||
"type-is": {
|
||||
"version": "1.6.15",
|
||||
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.15.tgz",
|
||||
"integrity": "sha1-yrEPtJCeRByChC6v4a1kbIGARBA=",
|
||||
"requires": {
|
||||
"media-typer": "0.3.0",
|
||||
"mime-types": "2.1.15"
|
||||
}
|
||||
},
|
||||
"unpipe": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
|
||||
},
|
||||
"urix": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz",
|
||||
"integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI="
|
||||
},
|
||||
"utils-merge": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.0.tgz",
|
||||
"integrity": "sha1-ApT7kiu5N1FTVBxPcJYjHyh8ivg="
|
||||
},
|
||||
"vary": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.1.tgz",
|
||||
"integrity": "sha1-Z1Neu2lMHVIldFeYRmUyP1h+jTc="
|
||||
},
|
||||
"xhr2": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/xhr2/-/xhr2-0.1.4.tgz",
|
||||
"integrity": "sha1-f4dliEdxbbUCYyOBL4GMras4el8="
|
||||
}
|
||||
}
|
||||
}
|
||||
20
phpcs.xml.dist
Normal file
20
phpcs.xml.dist
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?>
|
||||
<ruleset name="Expressive Skeleton coding standard">
|
||||
<description>Expressive Skeleton coding standard</description>
|
||||
|
||||
<!-- display progress -->
|
||||
<arg value="p"/>
|
||||
<arg name="colors"/>
|
||||
|
||||
<!-- inherit rules from: -->
|
||||
<rule ref="PSR2"/>
|
||||
<rule ref="Generic.Arrays.DisallowLongArraySyntax"/>
|
||||
<rule ref="Squiz.WhiteSpace.SuperfluousWhitespace">
|
||||
<properties>
|
||||
<property name="ignoreBlankLines" value="false"/>
|
||||
</properties>
|
||||
</rule>
|
||||
|
||||
<!-- Paths to check -->
|
||||
<file>src</file>
|
||||
</ruleset>
|
||||
17
phpunit.xml.dist
Normal file
17
phpunit.xml.dist
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true">
|
||||
<testsuites>
|
||||
<testsuite name="App\\Tests">
|
||||
<directory>./test</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory suffix=".php">./src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
17
public/.htaccess
Normal file
17
public/.htaccess
Normal file
@ -0,0 +1,17 @@
|
||||
RewriteEngine On
|
||||
# The following rule tells Apache that if the requested filename
|
||||
# exists, simply serve it.
|
||||
RewriteCond %{REQUEST_FILENAME} -s [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -l [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^.*$ - [NC,L]
|
||||
|
||||
# The following rewrites all other queries to index.php. The
|
||||
# condition ensures that if you are using Apache aliases to do
|
||||
# mass virtual hosting, the base path will be prepended to
|
||||
# allow proper resolution of the index.php file; it will work
|
||||
# in non-aliased environments as well, providing a safe, one-size
|
||||
# fits all solution.
|
||||
RewriteCond %{REQUEST_URI}::$1 ^(/.+)(.+)::\2$
|
||||
RewriteRule ^(.*) - [E=BASE:%1]
|
||||
RewriteRule ^(.*)$ %{ENV:BASE}index.php [NC,L]
|
||||
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
29
public/index.php
Normal file
29
public/index.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
// Delegate static file requests back to the PHP built-in webserver
|
||||
if (php_sapi_name() === 'cli-server'
|
||||
&& is_file(__DIR__ . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH))
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
chdir(dirname(__DIR__));
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
/**
|
||||
* Self-called anonymous function that creates its own scope and keep the global namespace clean.
|
||||
*/
|
||||
call_user_func(function () {
|
||||
/** @var \Interop\Container\ContainerInterface $container */
|
||||
$container = require 'config/container.php';
|
||||
|
||||
/** @var \Zend\Expressive\Application $app */
|
||||
$app = $container->get(\Zend\Expressive\Application::class);
|
||||
|
||||
// Import programmatic/declarative middleware pipeline and routing
|
||||
// configuration statements
|
||||
require 'config/pipeline.php';
|
||||
require 'config/routes.php';
|
||||
|
||||
$app->run();
|
||||
});
|
||||
BIN
public/zf-logo.png
Normal file
BIN
public/zf-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 600 B |
27
src/App/Action/GetGalleryImagesAction.php
Normal file
27
src/App/Action/GetGalleryImagesAction.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Action;
|
||||
|
||||
use App\Service\GalleryService;
|
||||
use Interop\Http\ServerMiddleware\DelegateInterface;
|
||||
use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
|
||||
class GetGalleryImagesAction implements ServerMiddlewareInterface
|
||||
{
|
||||
private $galleryService;
|
||||
|
||||
public function __construct(GalleryService $galleryService)
|
||||
{
|
||||
$this->galleryService = $galleryService;
|
||||
}
|
||||
|
||||
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
|
||||
{
|
||||
$slug = $request->getAttribute('slug', false);
|
||||
return new JsonResponse([
|
||||
'images' => $this->galleryService->getGallery($slug),
|
||||
]);
|
||||
}
|
||||
}
|
||||
15
src/App/Action/GetGalleryImagesFactory.php
Normal file
15
src/App/Action/GetGalleryImagesFactory.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Action;
|
||||
|
||||
use App\Service\GalleryService;
|
||||
use Interop\Container\ContainerInterface;
|
||||
|
||||
class GetGalleryImagesFactory
|
||||
{
|
||||
public function __invoke(ContainerInterface $container)
|
||||
{
|
||||
$galleryService = $container->get(GalleryService::class);
|
||||
return new GetGalleryImagesAction($galleryService);
|
||||
}
|
||||
}
|
||||
27
src/App/Action/GetImageAction.php
Normal file
27
src/App/Action/GetImageAction.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Action;
|
||||
|
||||
use App\Service\GalleryService;
|
||||
use Interop\Http\ServerMiddleware\DelegateInterface;
|
||||
use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
|
||||
class GetImageAction implements ServerMiddlewareInterface
|
||||
{
|
||||
private $galleryService;
|
||||
|
||||
public function __construct(GalleryService $galleryService)
|
||||
{
|
||||
$this->galleryService = $galleryService;
|
||||
}
|
||||
|
||||
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
|
||||
{
|
||||
$slug = $request->getAttribute('slug', false);
|
||||
return new JsonResponse([
|
||||
'images' => $this->galleryService->getGallery($slug),
|
||||
]);
|
||||
}
|
||||
}
|
||||
15
src/App/Action/GetImageFactory.php
Normal file
15
src/App/Action/GetImageFactory.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Action;
|
||||
|
||||
use App\Service\GalleryService;
|
||||
use Interop\Container\ContainerInterface;
|
||||
|
||||
class GetImageFactory
|
||||
{
|
||||
public function __invoke(ContainerInterface $container)
|
||||
{
|
||||
$galleryService = $container->get(GalleryService::class);
|
||||
return new GetImageAction($galleryService);
|
||||
}
|
||||
}
|
||||
63
src/App/Action/HomePageAction.php
Normal file
63
src/App/Action/HomePageAction.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Action;
|
||||
|
||||
use Interop\Http\ServerMiddleware\DelegateInterface;
|
||||
use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
use Zend\Expressive\Router;
|
||||
use Zend\Expressive\Template;
|
||||
use Zend\Expressive\Plates\PlatesRenderer;
|
||||
use Zend\Expressive\Twig\TwigRenderer;
|
||||
use Zend\Expressive\ZendView\ZendViewRenderer;
|
||||
|
||||
class HomePageAction implements ServerMiddlewareInterface
|
||||
{
|
||||
private $router;
|
||||
|
||||
private $template;
|
||||
|
||||
public function __construct(Router\RouterInterface $router, Template\TemplateRendererInterface $template = null)
|
||||
{
|
||||
$this->router = $router;
|
||||
$this->template = $template;
|
||||
}
|
||||
|
||||
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
|
||||
{
|
||||
if (! $this->template) {
|
||||
return new JsonResponse([
|
||||
'welcome' => 'Congratulations! You have installed the zend-expressive skeleton application.',
|
||||
'docsUrl' => 'https://docs.zendframework.com/zend-expressive/',
|
||||
]);
|
||||
}
|
||||
|
||||
$data = [];
|
||||
|
||||
if ($this->router instanceof Router\AuraRouter) {
|
||||
$data['routerName'] = 'Aura.Router';
|
||||
$data['routerDocs'] = 'http://auraphp.com/packages/2.x/Router.html';
|
||||
} elseif ($this->router instanceof Router\FastRouteRouter) {
|
||||
$data['routerName'] = 'FastRoute';
|
||||
$data['routerDocs'] = 'https://github.com/nikic/FastRoute';
|
||||
} elseif ($this->router instanceof Router\ZendRouter) {
|
||||
$data['routerName'] = 'Zend Router';
|
||||
$data['routerDocs'] = 'https://docs.zendframework.com/zend-router/';
|
||||
}
|
||||
|
||||
if ($this->template instanceof PlatesRenderer) {
|
||||
$data['templateName'] = 'Plates';
|
||||
$data['templateDocs'] = 'http://platesphp.com/';
|
||||
} elseif ($this->template instanceof TwigRenderer) {
|
||||
$data['templateName'] = 'Twig';
|
||||
$data['templateDocs'] = 'http://twig.sensiolabs.org/documentation';
|
||||
} elseif ($this->template instanceof ZendViewRenderer) {
|
||||
$data['templateName'] = 'Zend View';
|
||||
$data['templateDocs'] = 'https://docs.zendframework.com/zend-view/';
|
||||
}
|
||||
|
||||
return new HtmlResponse($this->template->render('app::home-page', $data));
|
||||
}
|
||||
}
|
||||
20
src/App/Action/HomePageFactory.php
Normal file
20
src/App/Action/HomePageFactory.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Action;
|
||||
|
||||
use Interop\Container\ContainerInterface;
|
||||
use Zend\Expressive\Router\RouterInterface;
|
||||
use Zend\Expressive\Template\TemplateRendererInterface;
|
||||
|
||||
class HomePageFactory
|
||||
{
|
||||
public function __invoke(ContainerInterface $container)
|
||||
{
|
||||
$router = $container->get(RouterInterface::class);
|
||||
$template = $container->has(TemplateRendererInterface::class)
|
||||
? $container->get(TemplateRendererInterface::class)
|
||||
: null;
|
||||
|
||||
return new HomePageAction($router, $template);
|
||||
}
|
||||
}
|
||||
26
src/App/Action/ListGalleriesAction.php
Normal file
26
src/App/Action/ListGalleriesAction.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Action;
|
||||
|
||||
use App\Service\GalleryService;
|
||||
use Interop\Http\ServerMiddleware\DelegateInterface;
|
||||
use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
|
||||
class ListGalleriesAction implements ServerMiddlewareInterface
|
||||
{
|
||||
private $galleryService;
|
||||
|
||||
public function __construct(GalleryService $galleryService)
|
||||
{
|
||||
$this->galleryService = $galleryService;
|
||||
}
|
||||
|
||||
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
|
||||
{
|
||||
return new JsonResponse([
|
||||
'galleries' => $this->galleryService->listGalleries()
|
||||
]);
|
||||
}
|
||||
}
|
||||
15
src/App/Action/ListGalleriesFactory.php
Normal file
15
src/App/Action/ListGalleriesFactory.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Action;
|
||||
|
||||
use App\Service\GalleryService;
|
||||
use Interop\Container\ContainerInterface;
|
||||
|
||||
class ListGalleriesFactory
|
||||
{
|
||||
public function __invoke(ContainerInterface $container)
|
||||
{
|
||||
$galleryService = $container->get(GalleryService::class);
|
||||
return new ListGalleriesAction($galleryService);
|
||||
}
|
||||
}
|
||||
16
src/App/Action/PingAction.php
Normal file
16
src/App/Action/PingAction.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Action;
|
||||
|
||||
use Interop\Http\ServerMiddleware\DelegateInterface;
|
||||
use Interop\Http\ServerMiddleware\MiddlewareInterface as ServerMiddlewareInterface;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
class PingAction implements ServerMiddlewareInterface
|
||||
{
|
||||
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
|
||||
{
|
||||
return new JsonResponse(['ack' => time()]);
|
||||
}
|
||||
}
|
||||
63
src/App/ConfigProvider.php
Normal file
63
src/App/ConfigProvider.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
/**
|
||||
* The configuration provider for the App module
|
||||
*
|
||||
* @see https://docs.zendframework.com/zend-component-installer/
|
||||
*/
|
||||
class ConfigProvider
|
||||
{
|
||||
/**
|
||||
* Returns the configuration array
|
||||
*
|
||||
* To add a bit of a structure, each section is defined in a separate
|
||||
* method which returns an array with its configuration.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function __invoke()
|
||||
{
|
||||
return [
|
||||
'dependencies' => $this->getDependencies(),
|
||||
'templates' => $this->getTemplates(),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the container dependencies
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getDependencies()
|
||||
{
|
||||
return [
|
||||
'invokables' => [
|
||||
Action\PingAction::class => Action\PingAction::class,
|
||||
],
|
||||
'factories' => [
|
||||
Action\HomePageAction::class => Action\HomePageFactory::class,
|
||||
Action\ListGalleriesAction::class => Action\ListGalleriesFactory::class,
|
||||
Action\GetGalleryImagesAction::class => Action\GetGalleryImagesFactory::class,
|
||||
Action\GetImageAction::class => Action\GetImageFactory::class,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the templates configuration
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTemplates()
|
||||
{
|
||||
return [
|
||||
'paths' => [
|
||||
'app' => ['templates/app'],
|
||||
'error' => ['templates/error'],
|
||||
'layout' => ['templates/layout'],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
104
src/App/Service/GalleryService.php
Normal file
104
src/App/Service/GalleryService.php
Normal file
@ -0,0 +1,104 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
|
||||
use Imagine\Gd\Imagine;
|
||||
use Imagine\Image\Box;
|
||||
use Imagine\Image\ImageInterface;
|
||||
use Symfony\Component\Yaml\Parser;
|
||||
use Zend\Config\Reader\Yaml;
|
||||
|
||||
class GalleryService
|
||||
{
|
||||
|
||||
const CONFIG_FILE = 'data/galleries/gallery.yaml';
|
||||
const IMAGE_BASEDIR = 'data/galleries/%s/';
|
||||
const THUMBNAIL_SIZE = 250;
|
||||
|
||||
protected $contentTypeMap = [
|
||||
'jpg' => 'image/jpeg',
|
||||
'jpeg' => 'image/jpeg',
|
||||
'png' => 'image/png',
|
||||
];
|
||||
protected $config;
|
||||
|
||||
public function listGalleries($includeHidden = false)
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
$slugs = [];
|
||||
foreach ($config['galleries'] as $id => $data) {
|
||||
if ($includeHidden || $data['public']) {
|
||||
$slugs[] = [
|
||||
'id' => $id,
|
||||
'label' => $data['name'],
|
||||
'new' => $data['new'],
|
||||
];
|
||||
}
|
||||
}
|
||||
return $slugs;
|
||||
}
|
||||
|
||||
public function getGallery(string $slug)
|
||||
{
|
||||
$galleryList = $this->listGalleries(true);
|
||||
$slugs = array_map(function($item) {
|
||||
return $item['id'];
|
||||
}, $galleryList);
|
||||
$config = $this->getConfig();
|
||||
$images = [];
|
||||
|
||||
if (in_array($slug, $slugs)) {
|
||||
$dir = $config['galleries'][$slug]['dir'];
|
||||
$images = array_map('basename', glob(sprintf(self::IMAGE_BASEDIR . "*.{jpg,jpeg,png}", $dir), GLOB_BRACE));
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => $config['galleries'][$slug]['name'],
|
||||
'type' => $config['galleries'][$slug]['type'],
|
||||
'images' => $images,
|
||||
];
|
||||
}
|
||||
|
||||
public function getImage(string $slug, string $image, bool $size)
|
||||
{
|
||||
$config = $this->getConfig();
|
||||
$galleryDir = sprintf(self::IMAGE_BASEDIR, $config['galleries'][$slug]['dir']);
|
||||
$imageFileName = $size
|
||||
? $galleryDir . $image
|
||||
: $this->getResizedImageName($galleryDir, $image, $size);
|
||||
|
||||
return fopen($imageFileName, 'r');
|
||||
}
|
||||
|
||||
protected function getResizedImageName($galleryDirectory, $imageName, $size)
|
||||
{
|
||||
$numericSize = $size == 'thumb' ? self::THUMBNAIL_SIZE : $size;
|
||||
|
||||
$thumbPath = $galleryDirectory . "thumb_" . $numericSize;
|
||||
@mkdir($thumbPath);
|
||||
$thumbImageName = $thumbPath . "/" . $imageName;
|
||||
|
||||
if (!file_exists($thumbImageName)) {
|
||||
$thumbSize = new Box($numericSize, $numericSize);
|
||||
$imagine = new Imagine();
|
||||
$image = $imagine->open($galleryDirectory . $imageName)
|
||||
->thumbnail($thumbSize, ImageInterface::THUMBNAIL_OUTBOUND);
|
||||
$image->effects()->sharpen();
|
||||
$image->save($thumbImageName);
|
||||
}
|
||||
|
||||
return $thumbImageName;
|
||||
}
|
||||
|
||||
protected function getConfig()
|
||||
{
|
||||
if (null === $this->config) {
|
||||
$parser = new Parser();
|
||||
$configReader = new Yaml([$parser, 'parse']);
|
||||
$this->config = $configReader->fromFile(self::CONFIG_FILE);
|
||||
}
|
||||
return $this->config;
|
||||
}
|
||||
}
|
||||
52
test/AppTest/Action/HomePageActionTest.php
Normal file
52
test/AppTest/Action/HomePageActionTest.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace AppTest\Action;
|
||||
|
||||
use App\Action\HomePageAction;
|
||||
use Interop\Http\ServerMiddleware\DelegateInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Argument;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Zend\Diactoros\Response\HtmlResponse;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
use Zend\Expressive\Router\RouterInterface;
|
||||
use Zend\Expressive\Template\TemplateRendererInterface;
|
||||
|
||||
class HomePageActionTest extends TestCase
|
||||
{
|
||||
/** @var RouterInterface */
|
||||
protected $router;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->router = $this->prophesize(RouterInterface::class);
|
||||
}
|
||||
|
||||
public function testReturnsJsonResponseWhenNoTemplateRendererProvided()
|
||||
{
|
||||
$homePage = new HomePageAction($this->router->reveal(), null);
|
||||
$response = $homePage->process(
|
||||
$this->prophesize(ServerRequestInterface::class)->reveal(),
|
||||
$this->prophesize(DelegateInterface::class)->reveal()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(JsonResponse::class, $response);
|
||||
}
|
||||
|
||||
public function testReturnsHtmlResponseWhenTemplateRendererProvided()
|
||||
{
|
||||
$renderer = $this->prophesize(TemplateRendererInterface::class);
|
||||
$renderer
|
||||
->render('app::home-page', Argument::type('array'))
|
||||
->willReturn('');
|
||||
|
||||
$homePage = new HomePageAction($this->router->reveal(), $renderer->reveal());
|
||||
|
||||
$response = $homePage->process(
|
||||
$this->prophesize(ServerRequestInterface::class)->reveal(),
|
||||
$this->prophesize(DelegateInterface::class)->reveal()
|
||||
);
|
||||
|
||||
$this->assertInstanceOf(HtmlResponse::class, $response);
|
||||
}
|
||||
}
|
||||
51
test/AppTest/Action/HomePageFactoryTest.php
Normal file
51
test/AppTest/Action/HomePageFactoryTest.php
Normal file
@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace AppTest\Action;
|
||||
|
||||
use App\Action\HomePageAction;
|
||||
use App\Action\HomePageFactory;
|
||||
use Interop\Container\ContainerInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Zend\Expressive\Router\RouterInterface;
|
||||
use Zend\Expressive\Template\TemplateRendererInterface;
|
||||
|
||||
class HomePageFactoryTest extends TestCase
|
||||
{
|
||||
/** @var ContainerInterface */
|
||||
protected $container;
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->container = $this->prophesize(ContainerInterface::class);
|
||||
$router = $this->prophesize(RouterInterface::class);
|
||||
|
||||
$this->container->get(RouterInterface::class)->willReturn($router);
|
||||
}
|
||||
|
||||
public function testFactoryWithoutTemplate()
|
||||
{
|
||||
$factory = new HomePageFactory();
|
||||
$this->container->has(TemplateRendererInterface::class)->willReturn(false);
|
||||
|
||||
$this->assertInstanceOf(HomePageFactory::class, $factory);
|
||||
|
||||
$homePage = $factory($this->container->reveal());
|
||||
|
||||
$this->assertInstanceOf(HomePageAction::class, $homePage);
|
||||
}
|
||||
|
||||
public function testFactoryWithTemplate()
|
||||
{
|
||||
$factory = new HomePageFactory();
|
||||
$this->container->has(TemplateRendererInterface::class)->willReturn(true);
|
||||
$this->container
|
||||
->get(TemplateRendererInterface::class)
|
||||
->willReturn($this->prophesize(TemplateRendererInterface::class));
|
||||
|
||||
$this->assertInstanceOf(HomePageFactory::class, $factory);
|
||||
|
||||
$homePage = $factory($this->container->reveal());
|
||||
|
||||
$this->assertInstanceOf(HomePageAction::class, $homePage);
|
||||
}
|
||||
}
|
||||
26
test/AppTest/Action/PingActionTest.php
Normal file
26
test/AppTest/Action/PingActionTest.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace AppTest\Action;
|
||||
|
||||
use App\Action\PingAction;
|
||||
use Interop\Http\ServerMiddleware\DelegateInterface;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
|
||||
class PingActionTest extends TestCase
|
||||
{
|
||||
public function testResponse()
|
||||
{
|
||||
$pingAction = new PingAction();
|
||||
$response = $pingAction->process(
|
||||
$this->prophesize(ServerRequestInterface::class)->reveal(),
|
||||
$this->prophesize(DelegateInterface::class)->reveal()
|
||||
);
|
||||
|
||||
$json = json_decode((string) $response->getBody());
|
||||
|
||||
$this->assertInstanceOf(JsonResponse::class, $response);
|
||||
$this->assertTrue(isset($json->ack));
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user