Merge branch '4.0'

This commit is contained in:
Benoît Burnichon
2016-03-16 17:21:57 +01:00
29 changed files with 668 additions and 464 deletions

View File

@@ -28,7 +28,8 @@
}
],
"require": {
"php": ">=5.5",
"php": ">=5.5.9",
"ext-intl": "*",
"alchemy-fr/tcpdf-clone": "~6.0",
"alchemy/embed-bundle": "^0.3.2",
"alchemy/geonames-api-consumer": "~0.1.0",
@@ -42,6 +43,7 @@
"alchemy/task-manager": "2.0.x-dev@dev",
"alchemy/zippy": "^0.3.0",
"beberlei/assert": "^2.3",
"cocur/slugify": "^2.0",
"dailymotion/sdk": "~1.5",
"data-uri/data-uri": "~0.1.0",
"dflydev/doctrine-orm-service-provider": "~1.0",

281
composer.lock generated
View File

@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "cf26537ff8480fca942c952933dd7c82",
"content-hash": "9ddbc47a8a36e87c0ab8ce91c2ebe2df",
"hash": "35011900fad9412c56c43a66366d0caa",
"content-hash": "2558d006aee664bdf9b253726bf6fdff",
"packages": [
{
"name": "alchemy-fr/tcpdf-clone",
@@ -15,12 +15,6 @@
"url": "https://github.com/alchemy-fr/tcpdf-clone.git",
"reference": "2ba0248a7187f1626df6c128750650416267f0e7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/tcpdf-clone/zipball/2ba0248a7187f1626df6c128750650416267f0e7",
"reference": "2ba0248a7187f1626df6c128750650416267f0e7",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
@@ -67,35 +61,31 @@
"qrcode",
"tcpdf"
],
"support": {
"source": "https://github.com/alchemy-fr/tcpdf-clone/tree/6.0.039",
"issues": "https://github.com/alchemy-fr/tcpdf-clone/issues"
},
"time": "2013-10-13 16:11:17"
},
{
"name": "alchemy/binary-driver",
"version": "1.5.0",
"version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/alchemy-fr/BinaryDriver.git",
"reference": "b32c03d4b56ce29f783051eac55887adae654b41"
"reference": "80c6633890afb71d2417ae851d0ad167d8b00b95"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/BinaryDriver/zipball/b32c03d4b56ce29f783051eac55887adae654b41",
"reference": "b32c03d4b56ce29f783051eac55887adae654b41",
"url": "https://api.github.com/repos/alchemy-fr/BinaryDriver/zipball/80c6633890afb71d2417ae851d0ad167d8b00b95",
"reference": "80c6633890afb71d2417ae851d0ad167d8b00b95",
"shasum": ""
},
"require": {
"evenement/evenement": "~1.0",
"monolog/monolog": "~1.3",
"php": ">=5.3.3",
"psr/log": "~1.0",
"symfony/process": "~2.0"
"evenement/evenement": "^2.0|^1.0",
"monolog/monolog": "^1.3",
"php": ">=5.5",
"psr/log": "^1.0",
"symfony/process": "^2.0|^3.0"
},
"require-dev": {
"phpunit/phpunit": "~3.7"
"phpunit/phpunit": "^4.0|^5.0"
},
"type": "library",
"autoload": {
@@ -128,7 +118,7 @@
"binary",
"driver"
],
"time": "2013-06-21 15:51:20"
"time": "2016-03-02 13:49:15"
},
{
"name": "alchemy/embed-bundle",
@@ -546,12 +536,6 @@
"url": "https://github.com/alchemy-fr/symfony-cors.git",
"reference": "dbf7fcff1ce9fc1265db12955476ff169eab7375"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/symfony-cors/zipball/dbf7fcff1ce9fc1265db12955476ff169eab7375",
"reference": "dbf7fcff1ce9fc1265db12955476ff169eab7375",
"shasum": ""
},
"require": {
"symfony/http-kernel": "^2.3.0|^3.0.0"
},
@@ -572,7 +556,11 @@
"Alchemy\\CorsBundle\\": "src/Bundle/"
}
},
"notification-url": "https://packagist.org/downloads/",
"autoload-dev": {
"psr-4": {
"Alchemy\\Cors\\Tests\\": "tests/unit/Component/"
}
},
"license": [
"MIT"
],
@@ -591,12 +579,12 @@
"source": {
"type": "git",
"url": "https://github.com/alchemy-fr/task-manager.git",
"reference": "cefd59cad3ac9b26243f551e704e7142fca79522"
"reference": "2b199e842551a1137640c822f433751a9f402099"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/alchemy-fr/task-manager/zipball/2b199e842551a1137640c822f433751a9f402099",
"reference": "cefd59cad3ac9b26243f551e704e7142fca79522",
"reference": "2b199e842551a1137640c822f433751a9f402099",
"shasum": ""
},
"require": {
@@ -609,7 +597,7 @@
},
"require-dev": {
"monolog/monolog": "~1.0",
"phpunit/phpunit": "~3.7",
"phpunit/phpunit": "~3.7|^4.0|^5.0",
"symfony/console": "~2.3",
"symfony/finder": "~2.1"
},
@@ -646,7 +634,7 @@
"parallel",
"process"
],
"time": "2014-02-14 12:39:44"
"time": "2016-03-11 12:13:53"
},
{
"name": "alchemy/zippy",
@@ -866,6 +854,68 @@
],
"time": "2015-09-28 16:26:35"
},
{
"name": "cocur/slugify",
"version": "v2.0",
"source": {
"type": "git",
"url": "https://github.com/cocur/slugify.git",
"reference": "912bf41f940f9a4e38ff1284b1841eaa71911d7f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/cocur/slugify/zipball/912bf41f940f9a4e38ff1284b1841eaa71911d7f",
"reference": "912bf41f940f9a4e38ff1284b1841eaa71911d7f",
"shasum": ""
},
"require": {
"php": ">=5.5.9"
},
"require-dev": {
"laravel/framework": "~5.1",
"latte/latte": "~2.2",
"mikey179/vfsstream": "~1.6",
"mockery/mockery": "~0.9",
"nette/di": "~2.2",
"phpunit/phpunit": "~4.8|~5.2",
"pimple/pimple": "~1.1",
"plumphp/plum": "~0.1",
"silex/silex": "~1.3",
"symfony/dependency-injection": "~2.4|~3.0",
"symfony/http-kernel": "~2.4|~3.0",
"twig/twig": "~1.12",
"zendframework/zend-modulemanager": "~2.2",
"zendframework/zend-servicemanager": "~2.2",
"zendframework/zend-view": "~2.2"
},
"type": "library",
"autoload": {
"psr-4": {
"Cocur\\Slugify\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ivo Bathke",
"email": "ivo.bathke@gmail.com"
},
{
"name": "Florian Eckerstorfer",
"email": "florian@eckerstorfer.co",
"homepage": "https://florian.ec"
}
],
"description": "Converts a string into a slug.",
"keywords": [
"slug",
"slugify"
],
"time": "2016-02-24 21:50:50"
},
{
"name": "dailymotion/sdk",
"version": "1.6.5",
@@ -1531,16 +1581,16 @@
},
{
"name": "doctrine/migrations",
"version": "v1.4.0",
"version": "1.4.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/migrations.git",
"reference": "abc571dadd45df42f19baac7a0a1a371216dd93d"
"reference": "0d0ff5da10c5d30846da32060bd9e357abf70a05"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/abc571dadd45df42f19baac7a0a1a371216dd93d",
"reference": "abc571dadd45df42f19baac7a0a1a371216dd93d",
"url": "https://api.github.com/repos/doctrine/migrations/zipball/0d0ff5da10c5d30846da32060bd9e357abf70a05",
"reference": "0d0ff5da10c5d30846da32060bd9e357abf70a05",
"shasum": ""
},
"require": {
@@ -1600,7 +1650,7 @@
"database",
"migrations"
],
"time": "2016-02-23 15:28:39"
"time": "2016-03-14 12:29:11"
},
{
"name": "doctrine/orm",
@@ -1741,12 +1791,12 @@
"source": {
"type": "git",
"url": "https://github.com/igorw/evenement.git",
"reference": "fa966683e7df3e5dd5929d984a44abfbd6bafe8d"
"reference": "v1.0.0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/igorw/evenement/zipball/fa966683e7df3e5dd5929d984a44abfbd6bafe8d",
"reference": "fa966683e7df3e5dd5929d984a44abfbd6bafe8d",
"reference": "v1.0.0",
"shasum": ""
},
"require": {
@@ -1773,7 +1823,7 @@
"keywords": [
"event-dispatcher"
],
"time": "2012-05-30 15:01:08"
"time": "2012-05-30 08:01:08"
},
{
"name": "facebook/php-sdk",
@@ -1819,7 +1869,6 @@
"facebook",
"sdk"
],
"abandoned": "facebook/php-sdk-v4",
"time": "2013-11-19 23:11:14"
},
{
@@ -2661,12 +2710,12 @@
"source": {
"type": "git",
"url": "https://github.com/hoaproject/Stream.git",
"reference": "3bc446bc00849bf51166adc415d77aa375d48d8c"
"reference": "011ab91d942f1d7096deade4c8a10fe57d51c5b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hoaproject/Stream/zipball/3bc446bc00849bf51166adc415d77aa375d48d8c",
"reference": "3bc446bc00849bf51166adc415d77aa375d48d8c",
"reference": "011ab91d942f1d7096deade4c8a10fe57d51c5b3",
"shasum": ""
},
"require": {
@@ -2711,7 +2760,7 @@
"stream",
"wrapper"
],
"time": "2015-10-26 12:21:43"
"time": "2015-10-22 06:30:43"
},
{
"name": "hoa/ustring",
@@ -3369,16 +3418,16 @@
},
{
"name": "league/flysystem",
"version": "1.0.17",
"version": "1.0.20",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "02f5b6c9a8b9278c8381e3361e7bd9d641c740ca"
"reference": "e87a786e3ae12a25cf78a71bb07b4b384bfaa83a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/02f5b6c9a8b9278c8381e3361e7bd9d641c740ca",
"reference": "02f5b6c9a8b9278c8381e3361e7bd9d641c740ca",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/e87a786e3ae12a25cf78a71bb07b4b384bfaa83a",
"reference": "e87a786e3ae12a25cf78a71bb07b4b384bfaa83a",
"shasum": ""
},
"require": {
@@ -3448,7 +3497,7 @@
"sftp",
"storage"
],
"time": "2016-02-19 15:35:38"
"time": "2016-03-14 21:54:11"
},
{
"name": "league/flysystem-aws-s3-v2",
@@ -3636,16 +3685,16 @@
},
{
"name": "monolog/monolog",
"version": "1.17.2",
"version": "1.18.1",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
"reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24"
"reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bee7f0dc9c3e0b69a6039697533dca1e845c8c24",
"reference": "bee7f0dc9c3e0b69a6039697533dca1e845c8c24",
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/a5f2734e8c16f3aa21b3da09715d10e15b4d2d45",
"reference": "a5f2734e8c16f3aa21b3da09715d10e15b4d2d45",
"shasum": ""
},
"require": {
@@ -3674,6 +3723,7 @@
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
"ext-mongo": "Allow sending log messages to a MongoDB server",
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
"mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver",
"php-console/php-console": "Allow sending log messages to Google Chrome",
"raven/raven": "Allow sending log messages to a Sentry server",
"rollbar/rollbar": "Allow sending log messages to Rollbar",
@@ -3683,7 +3733,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.16.x-dev"
"dev-master": "2.0.x-dev"
}
},
"autoload": {
@@ -3709,7 +3759,7 @@
"logging",
"psr-3"
],
"time": "2015-10-14 12:51:02"
"time": "2016-03-13 16:08:35"
},
{
"name": "mrclay/minify",
@@ -3741,7 +3791,7 @@
],
"authors": [
{
"name": "Steve Clay",
"name": "Stephen Clay",
"email": "steve@mrclay.org",
"homepage": "http://www.mrclay.org/",
"role": "Developer"
@@ -3927,21 +3977,21 @@
"source": {
"type": "git",
"url": "https://github.com/romainneutron/Imagine-Silex-Service-Provider.git",
"reference": "a8a7862ae90419f2b23746cd8436c2310e4eb084"
"reference": "0.1.2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/romainneutron/Imagine-Silex-Service-Provider/zipball/a8a7862ae90419f2b23746cd8436c2310e4eb084",
"reference": "a8a7862ae90419f2b23746cd8436c2310e4eb084",
"reference": "0.1.2",
"shasum": ""
},
"require": {
"imagine/imagine": "*",
"php": ">=5.3.3",
"silex/silex": "~1.0"
"silex/silex": ">=1.0,<2.0"
},
"require-dev": {
"symfony/browser-kit": "~2.0"
"symfony/browser-kit": ">=2.0,<3.0"
},
"type": "library",
"autoload": {
@@ -3970,23 +4020,24 @@
},
{
"name": "neutron/temporary-filesystem",
"version": "2.1.1",
"version": "2.2.0",
"source": {
"type": "git",
"url": "https://github.com/romainneutron/Temporary-Filesystem.git",
"reference": "6b21fa99fd452efea16b9a7adb7304ccfff854d0"
"reference": "0a72a1c858b95fd469d87baa333f627978504ea8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/romainneutron/Temporary-Filesystem/zipball/6b21fa99fd452efea16b9a7adb7304ccfff854d0",
"reference": "6b21fa99fd452efea16b9a7adb7304ccfff854d0",
"url": "https://api.github.com/repos/romainneutron/Temporary-Filesystem/zipball/0a72a1c858b95fd469d87baa333f627978504ea8",
"reference": "0a72a1c858b95fd469d87baa333f627978504ea8",
"shasum": ""
},
"require": {
"symfony/filesystem": "~2.0"
"php": "^5.3.9 || ^7.0",
"symfony/filesystem": "^2.3 || ^3.0"
},
"require-dev": {
"phpunit/phpunit": "~3.7"
"phpunit/phpunit": "^4.8"
},
"type": "library",
"autoload": {
@@ -4001,12 +4052,11 @@
"authors": [
{
"name": "Romain Neutron",
"email": "imprec@gmail.com",
"homepage": "http://www.lickmychip.com/"
"email": "imprec@gmail.com"
}
],
"description": "Symfony filesystem extension to handle temporary files",
"time": "2013-10-10 10:58:09"
"time": "2016-03-05 10:22:50"
},
{
"name": "nikic/php-parser",
@@ -4185,16 +4235,16 @@
},
{
"name": "paragonie/random_compat",
"version": "v1.2.1",
"version": "v1.2.2",
"source": {
"type": "git",
"url": "https://github.com/paragonie/random_compat.git",
"reference": "f078eba3bcf140fd69b5fcc3ea5ac809abf729dc"
"reference": "b3313b618f4edd76523572531d5d7e22fe747430"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/f078eba3bcf140fd69b5fcc3ea5ac809abf729dc",
"reference": "f078eba3bcf140fd69b5fcc3ea5ac809abf729dc",
"url": "https://api.github.com/repos/paragonie/random_compat/zipball/b3313b618f4edd76523572531d5d7e22fe747430",
"reference": "b3313b618f4edd76523572531d5d7e22fe747430",
"shasum": ""
},
"require": {
@@ -4229,7 +4279,7 @@
"pseudorandom",
"random"
],
"time": "2016-02-29 17:25:04"
"time": "2016-03-11 19:54:08"
},
{
"name": "php-ffmpeg/php-ffmpeg",
@@ -4747,12 +4797,12 @@
"source": {
"type": "git",
"url": "https://github.com/Roave/SecurityAdvisories.git",
"reference": "c18abc6df90257ddbbe2654a98cc5cc7be804411"
"reference": "ce4c36bdc9310ba76fdd167f16978f14ab3b8e42"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/ce4c36bdc9310ba76fdd167f16978f14ab3b8e42",
"reference": "c18abc6df90257ddbbe2654a98cc5cc7be804411",
"reference": "ce4c36bdc9310ba76fdd167f16978f14ab3b8e42",
"shasum": ""
},
"conflict": {
@@ -4783,12 +4833,14 @@
"namshi/jose": "<2.2",
"oro/crm": ">=1.7,<1.7.4",
"oro/platform": ">=1.7,<1.7.4",
"phpmailer/phpmailer": ">=5,<5.2.14",
"pusher/pusher-php-server": "<2.2.1",
"sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9",
"silverstripe/cms": ">=3.1,<3.1.11|>=3,<=3.0.11",
"silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3",
"silverstripe/framework": ">=3,<3.1|>=3.1,<3.2|>=3.2,<3.2.1",
"silverstripe/framework": ">=3,<3.1|>=3.1,<3.2|>=3.2,<3.3",
"silverstripe/userforms": "<3",
"simplesamlphp/simplesamlphp": "<=1.14.1",
"socalnick/scn-social-auth": "<1.15.2",
"swiftmailer/swiftmailer": ">=4,<4.99.99|>=5,<5.2.1",
"symfony/dependency-injection": ">=2,<2.0.17",
@@ -4855,7 +4907,7 @@
}
],
"description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it",
"time": "2016-02-14 18:50:07"
"time": "2016-03-15 19:40:54"
},
{
"name": "seld/jsonlint",
@@ -5352,7 +5404,7 @@
},
{
"name": "Phraseanet Team",
"email": "info@alchemy.fr",
"email": "support@alchemy.fr",
"homepage": "http://www.phraseanet.com/"
}
],
@@ -5418,16 +5470,16 @@
},
{
"name": "symfony/polyfill-apcu",
"version": "v1.1.0",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-apcu.git",
"reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c"
"reference": "0c901e4e65a2f7ece68f0fd249b56d6ad3adc214"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c",
"reference": "d1911e6caeb4b6a4c8e2d5c46b978a66b3745e4c",
"url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/0c901e4e65a2f7ece68f0fd249b56d6ad3adc214",
"reference": "0c901e4e65a2f7ece68f0fd249b56d6ad3adc214",
"shasum": ""
},
"require": {
@@ -5442,9 +5494,6 @@
"autoload": {
"files": [
"bootstrap.php"
],
"classmap": [
"Resources/stubs"
]
},
"notification-url": "https://packagist.org/downloads/",
@@ -5470,26 +5519,29 @@
"portable",
"shim"
],
"time": "2016-01-20 09:13:37"
"time": "2016-03-03 16:49:40"
},
{
"name": "symfony/polyfill-intl-icu",
"version": "v1.1.0",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-intl-icu.git",
"reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165"
"reference": "8328069d9f5322f0e7b3c3518485acfdc94c3942"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/66b0bb4abda229bc073eff6bbc8f2685bdaac165",
"reference": "66b0bb4abda229bc073eff6bbc8f2685bdaac165",
"url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/8328069d9f5322f0e7b3c3518485acfdc94c3942",
"reference": "8328069d9f5322f0e7b3c3518485acfdc94c3942",
"shasum": ""
},
"require": {
"php": ">=5.3.3",
"symfony/intl": "~2.3|~3.0"
},
"suggest": {
"ext-intl": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
@@ -5525,11 +5577,11 @@
"portable",
"shim"
],
"time": "2016-01-20 09:13:37"
"time": "2016-02-26 16:18:12"
},
{
"name": "symfony/polyfill-mbstring",
"version": "v1.1.0",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
@@ -5588,16 +5640,16 @@
},
{
"name": "symfony/polyfill-php54",
"version": "v1.1.0",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php54.git",
"reference": "74663d5a2ff3c530c1bc0571500e0feec9094054"
"reference": "9ba741ca01c77282ecf5796c2c1d667f03454ffb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/74663d5a2ff3c530c1bc0571500e0feec9094054",
"reference": "74663d5a2ff3c530c1bc0571500e0feec9094054",
"url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/9ba741ca01c77282ecf5796c2c1d667f03454ffb",
"reference": "9ba741ca01c77282ecf5796c2c1d667f03454ffb",
"shasum": ""
},
"require": {
@@ -5642,11 +5694,11 @@
"portable",
"shim"
],
"time": "2016-01-20 09:13:37"
"time": "2016-01-25 19:13:00"
},
{
"name": "symfony/polyfill-php55",
"version": "v1.1.0",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php55.git",
@@ -5702,7 +5754,7 @@
},
{
"name": "symfony/polyfill-php56",
"version": "v1.1.0",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php56.git",
@@ -5758,16 +5810,16 @@
},
{
"name": "symfony/polyfill-php70",
"version": "v1.1.0",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
"reference": "8428ceddbbaf102f2906769a8ef2438220c5cb95"
"reference": "386c1be9cad3ab531425211919e78c37971be4ce"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/8428ceddbbaf102f2906769a8ef2438220c5cb95",
"reference": "8428ceddbbaf102f2906769a8ef2438220c5cb95",
"url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/386c1be9cad3ab531425211919e78c37971be4ce",
"reference": "386c1be9cad3ab531425211919e78c37971be4ce",
"shasum": ""
},
"require": {
@@ -5813,11 +5865,11 @@
"portable",
"shim"
],
"time": "2016-01-25 08:44:42"
"time": "2016-01-28 22:42:02"
},
{
"name": "symfony/polyfill-util",
"version": "v1.1.0",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-util.git",
@@ -7006,16 +7058,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.8.23",
"version": "4.8.24",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "6e351261f9cd33daf205a131a1ba61c6d33bd483"
"reference": "a1066c562c52900a142a0e2bbf0582994671385e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6e351261f9cd33daf205a131a1ba61c6d33bd483",
"reference": "6e351261f9cd33daf205a131a1ba61c6d33bd483",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1066c562c52900a142a0e2bbf0582994671385e",
"reference": "a1066c562c52900a142a0e2bbf0582994671385e",
"shasum": ""
},
"require": {
@@ -7074,7 +7126,7 @@
"testing",
"xunit"
],
"time": "2016-02-11 14:56:33"
"time": "2016-03-14 06:16:08"
},
{
"name": "phpunit/phpunit-mock-objects",
@@ -7517,7 +7569,8 @@
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.5"
"php": ">=5.5.9",
"ext-intl": "*"
},
"platform-dev": []
}

View File

@@ -14,7 +14,6 @@ use Alchemy\Phrasea\Model\Entities\User;
trait AclAware
{
/** @var ACLProvider */
private $aclProvider;
/**
@@ -45,17 +44,20 @@ trait AclAware
return $this->aclProvider;
}
if (null === $this->aclProvider && $this instanceof \Pimple && $this->offsetExists('acl')) {
$this->aclProvider = function () {
$locator = $this->aclProvider;
if (null === $locator && $this instanceof \Pimple && $this->offsetExists('acl')) {
$locator = function () {
return $this['acl'];
};
}
if (null === $this->aclProvider) {
if (null === $locator) {
throw new \LogicException(ACLProvider::class . ' instance or locator was not set');
}
$instance = call_user_func($this->aclProvider);
$instance = $locator();
if (!$instance instanceof ACLProvider) {
throw new \LogicException(sprintf(
'Expects locator to return instance of "%s", got "%s"',

View File

@@ -13,24 +13,35 @@ namespace Alchemy\Phrasea\Authentication\Phrasea;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Authentication\Exception\RequireCaptchaException;
use Alchemy\Phrasea\Model\Repositories\AuthFailureRepository;
use Doctrine\ORM\EntityManager;
use Alchemy\Phrasea\Model\Entities\AuthFailure;
use Doctrine\ORM\EntityRepository;
use Neutron\ReCaptcha\ReCaptcha;
use Symfony\Component\HttpFoundation\Request;
class FailureManager
{
/** @var ReCaptcha */
/**
* @var ReCaptcha
*/
private $captcha;
/** @var EntityManager */
/**
* @var EntityManager
*/
private $em;
/** @var EntityRepository */
/**
* @var AuthFailureRepository
*/
private $repository;
/** @var integer */
/**
* @var int
*/
private $trials;
public function __construct(EntityRepository $repo, EntityManager $em, ReCaptcha $captcha, $trials)
public function __construct(AuthFailureRepository $repo, EntityManager $em, ReCaptcha $captcha, $trials)
{
$this->captcha = $captcha;
$this->em = $em;
@@ -40,9 +51,12 @@ class FailureManager
throw new InvalidArgumentException('Trials number must be a positive integer');
}
$this->trials = $trials;
$this->trials = (int)$trials;
}
/**
* @return int
*/
public function getTrials()
{
return $this->trials;
@@ -86,36 +100,38 @@ class FailureManager
$failures = $this->repository->findLockedFailuresMatching($username, $request->getClientIp());
if (0 === count($failures)) {
return;
return $this;
}
if ($this->trials < count($failures) && $this->captcha->isSetup()) {
$response = $this->captcha->bind($request);
if ($response->isValid()) {
if (!$response->isValid()) {
throw new RequireCaptchaException('Too many failures, require captcha');
}
foreach ($failures as $failure) {
$failure->setLocked(false);
}
$this->em->flush();
} else {
throw new RequireCaptchaException('Too much failure, require captcha');
}
$this->em->flush($failures);
}
return $this;
}
/**
* Removes failures older than 2 monthes
*/
private function removeOldFailures()
{
$failures = $this->repository->findOldFailures('-2 months');
if (0 < count($failures)) {
if (empty($failures)) {
return;
}
foreach ($failures as $failure) {
$this->em->remove($failure);
}
}
$this->em->flush($failures);
}
}

View File

@@ -15,13 +15,13 @@ use Alchemy\Phrasea\Authentication\Exception\NotAuthenticatedException;
use Alchemy\Phrasea\Authentication\Provider\Token\Token;
use Alchemy\Phrasea\Authentication\Provider\Token\Identity;
use Alchemy\Phrasea\Model\Entities\User;
use Doctrine\Common\Persistence\ObjectRepository;
use Alchemy\Phrasea\Model\Repositories\UserRepository;
class SuggestionFinder
{
private $repository;
public function __construct(ObjectRepository $repository)
public function __construct(UserRepository $repository)
{
$this->repository = $repository;
}

View File

@@ -33,19 +33,16 @@ class Factory
*/
public static function getFileAttribute(Application $app, $name, $serialized)
{
switch ($name) {
switch ($name)
{
case AttributeInterface::NAME_METADATA:
return Metadata::loadFromString($app, $serialized);
break;
case AttributeInterface::NAME_STORY:
return Story::loadFromString($app, $serialized);
break;
case AttributeInterface::NAME_METAFIELD:
return MetaField::loadFromString($app, $serialized);
break;
case AttributeInterface::NAME_STATUS:
return Status::loadFromString($app, $serialized);
break;
}
throw new \InvalidArgumentException(sprintf('Unknown attribute %s', $name));

View File

@@ -12,7 +12,6 @@
namespace Alchemy\Phrasea\Border\Attribute;
use Alchemy\Phrasea\Application;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Phraseanet Border MetaField Attribute
@@ -23,13 +22,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class MetaField implements AttributeInterface
{
/**
*
* @var \databox_field
*/
protected $databox_field;
/**
*
* @var array
*/
protected $value;
@@ -46,14 +43,6 @@ class MetaField implements AttributeInterface
$this->value = $value;
}
/**
* Destructor
*/
public function __destruct()
{
$this->metadata = $this->databox_field = null;
}
/**
* {@inheritdoc}
*/
@@ -101,15 +90,18 @@ class MetaField implements AttributeInterface
*/
public static function loadFromString(Application $app, $string)
{
if (!$datas = @unserialize($string)) {
$data = @unserialize($string);
if (!is_array($data) || !isset($data['sbas_id']) || !isset($data['id']) || !isset($data['value'])) {
throw new \InvalidArgumentException('Unable to load metadata from string');
}
try {
return new static($app->findDataboxById($datas['sbas_id'])
->get_meta_structure()->get_element($datas['id']), $datas['value']);
} catch (NotFoundHttpException $e) {
throw new \InvalidArgumentException('Field does not exist anymore');
$field = $app->findDataboxById($data['sbas_id'])->get_meta_structure()->get_element($data['id']);
return new static($field, $data['value']);
} catch (\Exception $exception) {
throw new \InvalidArgumentException('Field does not exist anymore', 0, $exception);
}
}
}

View File

@@ -129,8 +129,6 @@ class Manager
$callable($element, $visa, $code);
}
$visa = null;
return $code;
}

View File

@@ -45,8 +45,6 @@ class CLI extends Application
{
parent::__construct($environment);
$app = $this;
$this['session.test'] = true;
$this['console'] = $this->share(function () use ($name, $version) {

View File

@@ -100,7 +100,7 @@ EOT;
}
/**
* @param $collectionId
* @param int $collectionId
*/
public function setCollectionId($collectionId)
{
@@ -134,7 +134,7 @@ EOT;
}
/**
* @return \string[]
* @return string[]
*/
public function getLabels()
{
@@ -142,7 +142,7 @@ EOT;
}
/**
* @param \string[] $labels
* @param string[] $labels
*/
public function setLabels($labels)
{
@@ -150,7 +150,7 @@ EOT;
}
/**
* @param $lang
* @param string $lang
* @param bool $substitute
* @return string
*/
@@ -162,14 +162,14 @@ EOT;
if ($substitute) {
return isset($this->labels[$lang]) ? $this->labels[$lang] : $this->name;
} else {
return $this->labels[$lang];
}
return $this->labels[$lang];
}
/**
* @param $lang
* @param $label
* @param string $lang
* @param string $label
*/
public function setLabel($lang, $label)
{
@@ -181,7 +181,7 @@ EOT;
}
/**
* @return \int[]|string|null
* @return int[]|string|null
*/
public function getLogo()
{
@@ -189,7 +189,7 @@ EOT;
}
/**
* @param \int[]|string $logo
* @param int[]|string $logo
*/
public function setLogo($logo)
{

View File

@@ -21,7 +21,7 @@ class ArrayCacheCollectionRepository implements CollectionRepository
private $collectionRepository;
/**
* @var \collection[]
* @var \collection[]|null
*/
private $collectionCache = null;

View File

@@ -18,16 +18,13 @@ use Symfony\Component\Console\Output\OutputInterface;
class BuildMissingSubdefs extends Command
{
/**
* Constructor
*/
private $generator;
public function __construct($name = null)
{
parent::__construct($name);
$this->setDescription('Builds subviews that previously failed to be generated / did not exist when records were added');
return $this;
}
/**
@@ -37,48 +34,61 @@ class BuildMissingSubdefs extends Command
{
$start = microtime(true);
$progressBar = new ProgressBar($output);
$n = 0;
/** @var SubdefGenerator $subdefGenerator */
$subdefGenerator = $this->container['subdef.generator'];
$generatedSubdefs = 0;
foreach ($this->container->getDataboxes() as $databox) {
$sql = 'SELECT record_id FROM record WHERE parent_record_id = 0';
$stmt = $databox->get_connection()->prepare($sql);
$stmt->execute();
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
$progressBar->start(count($rs));
$result = $databox->get_connection()->executeQuery($sql)->fetchAll(\PDO::FETCH_ASSOC);
$progressBar->start(count($result));
foreach ($rs as $row) {
foreach ($result as $row) {
$record = $databox->get_record($row['record_id']);
$wanted_subdefs = $record->get_missing_subdefs();
$generatedSubdefs += $this->generateRecordMissingSubdefs($record);
if (count($wanted_subdefs) > 0) {
$subdefGenerator->generateSubdefs($record, $wanted_subdefs);
foreach ($wanted_subdefs as $subdef) {
$this->container['monolog']->addInfo("generate " . $subdef . " for record " . $record->getRecordId());
$n++;
}
}
unset($record);
$progressBar->advance();
}
$progressBar->finish();
}
$this->container['monolog']->addInfo($n . " subdefs done");
$this->container['monolog']->addInfo($generatedSubdefs . " subdefs done");
$stop = microtime(true);
$duration = $stop - $start;
$this->container['monolog']->addInfo(sprintf("process took %s, (%f sd/s.)", $this->getFormattedDuration($duration), round($n / $duration, 3)));
$this->container['monolog']->addInfo(sprintf("process took %s, (%f sd/s.)", $this->getFormattedDuration($duration), round($generatedSubdefs / $duration, 3)));
$progressBar->finish();
return;
}
/**
* Generate subdef generation and return number of subdef
* @param \record_adapter $record
* @return int
*/
protected function generateRecordMissingSubdefs(\record_adapter $record)
{
$wanted_subdefs = $record->get_missing_subdefs();
if (!empty($wanted_subdefs)) {
$this->getSubdefGenerator()->generateSubdefs($record, $wanted_subdefs);
foreach ($wanted_subdefs as $subdef) {
$this->container['monolog']->addInfo("generate " . $subdef . " for record " . $record->getRecordId());
}
}
return count($wanted_subdefs);
}
/**
* @return SubdefGenerator
*/
protected function getSubdefGenerator()
{
if (null === $this->generator) {
$this->generator = $this->container['subdef.generator'];
}
return $this->generator;
}
}

View File

@@ -1,9 +1,8 @@
<?php
/*
/**
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -14,19 +13,15 @@ namespace Alchemy\Phrasea\Command;
use Alchemy\Phrasea\Exception\InvalidArgumentException;
use Alchemy\Phrasea\Media\SubdefGenerator;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\SQLParserUtils;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\ProgressBar;
use media_subdef;
class BuildSubdefs extends Command
{
/**
* Constructor
*/
public function __construct($name = null)
{
parent::__construct($name);
@@ -39,8 +34,6 @@ class BuildSubdefs extends Command
$this->addOption('min_record', 'min', InputOption::VALUE_OPTIONAL, 'Min record id');
$this->addOption('with-substitution', 'wsubstit', InputOption::VALUE_NONE, 'Regenerate subdefs for substituted records as well');
$this->addOption('substitution-only', 'substito', InputOption::VALUE_NONE, 'Regenerate subdefs for substituted records only');
return $this;
}
/**
@@ -70,111 +63,46 @@ class BuildSubdefs extends Command
return;
}
$sqlCount = "SELECT COUNT(DISTINCT(r.record_id)) AS nb_records"
. " FROM record r LEFT JOIN subdef s ON (r.record_id = s.record_id AND s.name IN (?))"
. " WHERE r.type IN (?)";
$types = array(Connection::PARAM_STR_ARRAY, Connection::PARAM_STR_ARRAY);
$params = array($subdefsName, $recordsType);
if (null !== $min = $input->getOption('min_record')) {
$sqlCount .= " AND (r.record_id >= ?)";
$params[] = (int) $min;
$types[] = \PDO::PARAM_INT;
}
if (null !== $max = $input->getOption('max_record')) {
$sqlCount .= " AND (r.record_id <= ?)";
$params[] = (int) $max;
$types[] = \PDO::PARAM_INT;
}
$min = $input->getOption('min_record');
$max = $input->getOption('max_record');
$substitutionOnly = $input->getOption('substitution-only');
$withSubstitution = $input->getOption('with-substitution');
if (false === $withSubstitution) {
if (true === $substitutionOnly) {
$sqlCount .= " AND (ISNULL(s.substit) OR s.substit = 1)";
} else {
$sqlCount .= " AND (ISNULL(s.substit) OR s.substit = 0)";
}
} elseif ($substitutionOnly) {
if (false !== $withSubstitution && false !== $substitutionOnly) {
throw new InvalidArgumentException('Conflict, you can not ask for --substitution-only && --with-substitution parameters at the same time');
}
list($sqlCount, $stmtParams) = SQLParserUtils::expandListParameters($sqlCount, $params, $types);
list($sql, $params, $types) = $this->generateSQL($subdefsName, $recordsType, $min, $max, $withSubstitution, $substitutionOnly);
$databox = $this->container->findDataboxById($input->getArgument('databox'));
$output->writeln($sqlCount);
$connection = $databox->get_connection();
$stmt = $connection->prepare($sqlCount);
$stmt->execute($stmtParams);
$row = $stmt->fetch();
$totalRecords = $row['nb_records'];
$sqlCount = sprintf('SELECT COUNT(*) FROM (%s)', $sql);
$output->writeln($sqlCount);
$totalRecords = (int)$connection->executeQuery($sqlCount, $params, $types)->fetchColumn();
if ($totalRecords === 0) {
return;
}
/** @var HelperSet $helperSet */
$helperSet = $this->getHelperSet();
$progress = new ProgressBar($output, $totalRecords);
/** @var ProgressBar $progress */
$progress = $helperSet->get('progress');
$progress->start($output, $totalRecords);
$progress->start();
$progress->display();
$sql = "SELECT DISTINCT(r.record_id)"
. " FROM record r LEFT JOIN subdef s ON (r.record_id = s.record_id AND s.name IN (?))"
. " WHERE r.type IN (?)";
$types = array(Connection::PARAM_STR_ARRAY, Connection::PARAM_STR_ARRAY);
$params = array($subdefsName, $recordsType);
if ($min) {
$sql .= " AND (r.record_id >= ?)";
$params[] = (int) $min;
$types[] = \PDO::PARAM_INT;
}
if ($max) {
$sql .= " AND (r.record_id <= ?)";
$params[] = (int) $max;
$types[] = \PDO::PARAM_INT;
}
if (false === $withSubstitution) {
if (true === $substitutionOnly) {
$sql .= " AND (ISNULL(s.substit) OR s.substit = 1)";
} else {
$sql .= " AND (ISNULL(s.substit) OR s.substit = 0)";
}
}
list($sql, $stmtParams) = SQLParserUtils::expandListParameters($sql, $params, $types);
$connection = $databox->get_connection();
$stmt = $connection->prepare($sql);
$stmt->execute($stmtParams);
$rows = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$rows = $connection->executeQuery($sql, $params, $types)->fetchAll(\PDO::FETCH_ASSOC);
foreach ($rows as $row) {
$output->write(sprintf(' (#%s)', $row['record_id']));
$record = new \record_adapter($this->container, $databox->get_sbas_id(), $row['record_id']);
$record = $databox->get_record($row['record_id']);
/** @var media_subdef[] $subdefs */
$subdefs = array_filter($record->get_subdefs(), function(media_subdef $subdef) use ($subdefsName) {
return in_array($subdef->get_name(), $subdefsName);
});
/** @var media_subdef $subdef */
foreach ($subdefs as $subdef) {
$subdef->remove_file();
if (($withSubstitution && $subdef->is_substituted()) || $substitutionOnly) {
@@ -186,13 +114,49 @@ class BuildSubdefs extends Command
$subdefGenerator = $this->container['subdef.generator'];
$subdefGenerator->generateSubdefs($record, $subdefsName);
$stmt->closeCursor();
$progress->advance();
}
unset($rows, $record, $stmt, $connection);
$progress->finish();
}
/**
* @param string[] $subdefNames
* @param string[] $recordTypes
* @param null|int $min
* @param null|int $max
* @param bool $withSubstitution
* @param bool $substitutionOnly
* @return array
*/
protected function generateSQL(array $subdefNames, array $recordTypes, $min, $max, $withSubstitution, $substitutionOnly)
{
$sql = "SELECT DISTINCT(r.record_id) AS record_id"
. " FROM record r LEFT JOIN subdef s ON (r.record_id = s.record_id AND s.name IN (?))"
. " WHERE r.type IN (?)";
$types = array(Connection::PARAM_STR_ARRAY, Connection::PARAM_STR_ARRAY);
$params = array($subdefNames, $recordTypes);
if (null !== $min) {
$sql .= " AND (r.record_id >= ?)";
$params[] = (int)$min;
$types[] = \PDO::PARAM_INT;
}
if (null !== $max) {
$sql .= " AND (r.record_id <= ?)";
$params[] = (int)$max;
$types[] = \PDO::PARAM_INT;
}
if (false === $withSubstitution) {
$sql .= " AND (ISNULL(s.substit) OR s.substit = ?)";
$params[] = $substitutionOnly ? 1 : 0;
$types[] = \PDO::PARAM_INT;
}
return array($sql, $params, $types);
}
}

View File

@@ -105,7 +105,6 @@ class SearchEngineServiceProvider implements ServiceProviderInterface
$app['search_engine.structure'],
$app['elasticsearch.record_helper'],
$app['thesaurus'],
$app['phraseanet.appbox'],
array_keys($app['locales.available']),
$logger
);

View File

@@ -1,9 +1,8 @@
<?php
/*
/**
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,16 +10,15 @@
namespace Alchemy\Phrasea\Model\Repositories;
use Alchemy\Phrasea\Model\Entities\AuthFailure;
use Doctrine\ORM\EntityRepository;
/**
* AuthFailureRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class AuthFailureRepository extends EntityRepository
{
/**
* @param string $limit
* @return AuthFailure[]
*/
public function findOldFailures($limit = '-2 months')
{
$date = new \DateTime($limit);
@@ -37,6 +35,11 @@ class AuthFailureRepository extends EntityRepository
return $query->getResult();
}
/**
* @param string $username
* @param string $ip
* @return AuthFailure[]
*/
public function findLockedFailuresMatching($username, $ip)
{
$dql = 'SELECT f

View File

@@ -1,9 +1,8 @@
<?php
/*
/**
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -12,10 +11,6 @@
namespace Alchemy\Phrasea\SearchEngine\Elastic\Indexer;
use Alchemy\Phrasea\Model\RecordInterface;
use Alchemy\Phrasea\SearchEngine\Elastic\Exception\Exception;
use Alchemy\Phrasea\SearchEngine\Elastic\Exception\MergeException;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\BulkOperation;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Delegate\FetcherDelegate;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Delegate\FetcherDelegateInterface;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Delegate\RecordListFetcherDelegate;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Delegate\ScheduledFetcherDelegate;
@@ -26,10 +21,8 @@ use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Hydrator\MetadataHydrato
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Hydrator\SubDefinitionHydrator;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Hydrator\ThesaurusHydrator;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\Record\Hydrator\TitleHydrator;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\RecordQueuer;
use Alchemy\Phrasea\SearchEngine\Elastic\Mapping;
use Alchemy\Phrasea\SearchEngine\Elastic\RecordHelper;
use Alchemy\Phrasea\SearchEngine\Elastic\StringUtils;
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Field;
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Structure;
use Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus;
@@ -48,11 +41,6 @@ class RecordIndexer
private $thesaurus;
/**
* @var \appbox
*/
private $appbox;
/**
* @var array
*/
@@ -66,12 +54,11 @@ class RecordIndexer
return $_key . '_' . $record_key;
}
public function __construct(Structure $structure, RecordHelper $helper, Thesaurus $thesaurus, \appbox $appbox, array $locales, LoggerInterface $logger)
public function __construct(Structure $structure, RecordHelper $helper, Thesaurus $thesaurus, array $locales, LoggerInterface $logger)
{
$this->structure = $structure;
$this->helper = $helper;
$this->thesaurus = $thesaurus;
$this->appbox = $appbox;
$this->locales = $locales;
$this->logger = $logger;
}

View File

@@ -1,9 +1,8 @@
<?php
/*
/**
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,28 +10,46 @@
namespace Alchemy\Phrasea\SearchEngine\Elastic;
use Cocur\Slugify\Slugify;
use Cocur\Slugify\SlugifyInterface;
use Transliterator;
class StringUtils
{
/**
* @var SlugifyInterface|null
*/
private static $slugifier;
private static $transliterator;
/**
* Prevent instantiation of the class
*/
private function __construct()
{
}
public static function setSlugify(SlugifyInterface $slugify = null)
{
self::$slugifier = $slugify;
}
/**
* @return SlugifyInterface
*/
private static function getSlugifier()
{
if (null === self::$slugifier) {
self::$slugifier = new Slugify();
}
return self::$slugifier;
}
public static function slugify($string, $separator = '-')
{
// Replace non letter or digits by _
$string = preg_replace('/[^\\pL\d]+/u', $separator, $string);
$string = trim($string, $separator);
// Transliterate
if (function_exists('iconv')) {
$string = iconv('UTF-8', 'ASCII//TRANSLIT', $string);
}
// Remove non wording characters
$string = preg_replace('/[^-\w]+/', '', $string);
$string = strtolower($string);
return $string;
return self::getSlugifier()->slugify($string, $separator);
}
public static function asciiLowerFold($string)

View File

@@ -8,17 +8,39 @@ use DomainException;
final class GlobalStructure implements Structure
{
/** @var Field[] */
/**
* @var Field[]
*/
private $fields = array();
/** @var Field[] */
/**
* @var Field[]
* */
private $date_fields = array();
/** @var Field[] */
/**
* @var Field[]
*/
private $thesaurus_fields = array();
/** @var Field[] */
/**
* @var Field[]
*/
private $private = array();
/** @var Field[] */
/**
* @var Field[]
*/
private $facets = array();
/**
* @var Flag[]
*/
private $flags = array();
/**
* @var Tag[]
*/
private $metadata_tags = array();
/**
@@ -40,6 +62,12 @@ final class GlobalStructure implements Structure
return new self($fields, $flags, MetadataHelper::createTags());
}
/**
* GlobalStructure constructor.
* @param Field[] $fields
* @param Flag[] $flags
* @param Tag[] $metadata_tags
*/
public function __construct(array $fields = [], array $flags = [], array $metadata_tags = [])
{
Assertion::allIsInstanceOf($fields, Field::class);
@@ -78,16 +106,25 @@ final class GlobalStructure implements Structure
}
}
/**
* @return Field[]
*/
public function getAllFields()
{
return $this->fields;
}
/**
* @return Field[]
*/
public function getUnrestrictedFields()
{
return array_diff_key($this->fields, $this->private);
}
/**
* @return Field[]
*/
public function getPrivateFields()
{
return $this->private;
@@ -101,11 +138,17 @@ final class GlobalStructure implements Structure
return $this->facets;
}
/**
* @return Field[]
*/
public function getThesaurusEnabledFields()
{
return $this->thesaurus_fields;
}
/**
* @return Field[]
*/
public function getDateFields()
{
return $this->date_fields;
@@ -117,18 +160,22 @@ final class GlobalStructure implements Structure
*/
public function get($name)
{
return isset($this->fields[$name]) ?
$this->fields[$name] : null;
}
public function typeOf($name)
{
return isset($this->fields[$name]) ?
$this->fields[$name]->getType() : null;
return isset($this->fields[$name]) ? $this->fields[$name] : null;
}
/**
* @param $name
* @param string $name
* @return null|string
*/
public function typeOf($name)
{
$field = $this->get($name);
return $field ? $field->getType() : null;
}
/**
* @param string $name
* @return bool
*/
public function isPrivate($name)
@@ -142,26 +189,39 @@ final class GlobalStructure implements Structure
throw new DomainException(sprintf('Unknown field "%s".', $name));
}
/**
* @return Flag[]
*/
public function getAllFlags()
{
return $this->flags;
}
/**
* @param string $name
* @return Flag|null
*/
public function getFlagByName($name)
{
return isset($this->flags[$name]) ?
$this->flags[$name] : null;
}
/**
* @return Tag[]
*/
public function getMetadataTags()
{
return $this->metadata_tags;
}
/**
* @param string $name
* @return Tag|null
*/
public function getMetadataTagByName($name)
{
return isset($this->metadata_tags[$name]) ?
$this->metadata_tags[$name] : null;
return isset($this->metadata_tags[$name]) ? $this->metadata_tags[$name] : null;
}
/**
@@ -175,6 +235,7 @@ final class GlobalStructure implements Structure
public function getCollectionsUsedByPrivateFields()
{
$map = [];
foreach ($this->private as $name => $field) {
$map[$name] = $field->getDependantCollections();
}

View File

@@ -1,10 +1,16 @@
<?php
/**
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\SearchEngine\Elastic\Structure;
use Alchemy\Phrasea\SearchEngine\Elastic\Mapping;
use Alchemy\Phrasea\SearchEngine\SearchEngineOptions;
use DomainException;
/**
* Proxy structure request to underlying structure and filter results according

View File

@@ -1,14 +1,45 @@
<?php
/**
* This file is part of Phraseanet
*
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\SearchEngine\Elastic\Structure;
interface Structure
{
/**
* @return Field[]
*/
public function getAllFields();
/**
* @return Field[]
*/
public function getUnrestrictedFields();
/**
* @return Field[]
*/
public function getPrivateFields();
/**
* @return Field[]
*/
public function getFacetFields();
/**
* @return Field[]
*/
public function getThesaurusEnabledFields();
/**
* @return Field[]
*/
public function getDateFields();
/**
@@ -16,18 +47,39 @@ interface Structure
* @return null|Field
*/
public function get($name);
/**
* @param string $name
* @return string|null
*/
public function typeOf($name);
/**
* @param $name
* @param string $name
* @return bool
* @throws \DomainException
*/
public function isPrivate($name);
/**
* @return Flag[]
*/
public function getAllFlags();
/**
* @param string $name
* @return Flag
*/
public function getFlagByName($name);
/**
* @return Tag[]
*/
public function getMetadataTags();
/**
* @param string $name
* @return Tag|null
*/
public function getMetadataTagByName($name);
}

View File

@@ -1,9 +1,8 @@
<?php
/*
/**
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -16,7 +15,6 @@ use Alchemy\Phrasea\SearchEngine\Elastic\StringUtils;
use databox;
use DOMDocument;
use DOMElement;
use DOMNode;
use DOMNodeList;
use DOMXPath;
@@ -32,18 +30,21 @@ class Helper
$xpath = new DOMXPath($document);
$nodes = $xpath->query($expression);
$concepts = [];
foreach ($nodes as $node) {
$me_and_parents = array_merge([$node], self::getElementAncestors($node));
$path_segments = [];
$me_and_parents = [$node];
foreach (self::getElementAncestors($node) as $me_and_parents[]);
foreach ($me_and_parents as $node) {
if (Navigator::isConcept($node)) {
$path_segments[] = self::conceptPathSegment($node);
} else {
foreach ($me_and_parents as $me_or_parent) {
if (!Navigator::isConcept($me_or_parent)) {
// Silently skips invalid targeted nodes
break;
}
$path_segments[] = self::conceptPathSegment($me_or_parent);
}
// Concept paths are have databox identifier at root level
$concepts[] = new Concept(sprintf(
'/%d/%s',
@@ -58,7 +59,8 @@ class Helper
private static function getElementAncestors(DOMElement $element)
{
$parents = [];
while ($element = $element->parentNode) {
while (null !== $element = $element->parentNode) {
$parents[] = $element;
}

View File

@@ -1,9 +1,8 @@
<?php
/*
/**
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -11,13 +10,6 @@
namespace Alchemy\Phrasea\SearchEngine\Elastic\Thesaurus;
use Alchemy\Phrasea\SearchEngine\Elastic\ElasticSearchEngine;
use Alchemy\Phrasea\SearchEngine\Elastic\Mapping;
use Closure;
use Elasticsearch\Client;
use databox;
use DOMDocument;
use DOMElement;
use DOMNode;

View File

@@ -1,9 +1,9 @@
<?php
/*
/**
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
* (c) 2005-2016 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@@ -59,7 +59,7 @@ class EmptyCollectionJob extends AbstractJob
$settings = simplexml_load_string($task->getSettings());
$baseId = (string) $settings->base_id;
$baseId = (string) $settings->bas_id;
$collection = \collection::getByBaseId($app, $baseId);
$collection->empty_collection(200);

View File

@@ -7,6 +7,7 @@ use Alchemy\Phrasea\Model\Entities\ElasticsearchRecord;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\RecordInterface;
use Alchemy\Phrasea\Http\StaticFile\StaticMode;
use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Flag;
class PhraseanetExtension extends \Twig_Extension
{
@@ -44,6 +45,8 @@ class PhraseanetExtension extends \Twig_Extension
new \Twig_SimpleFunction('caption_field', array($this, 'getCaptionField')),
new \Twig_SimpleFunction('caption_field_label', array($this, 'getCaptionFieldLabel')),
new \Twig_SimpleFunction('caption_field_order', array($this, 'getCaptionFieldOrder')),
new \Twig_SimpleFunction('flag_slugify', array(Flag::class, 'normalizeName')),
);
}

View File

@@ -6,7 +6,7 @@
{% endif %}
<h1 style='padding-left:30px;'>
{{ 'status:: numero de bit' | trans }} {{ app['request'].get('bit') }}
{{ 'status:: numero de bit' | trans }} {{ app['request'].get('bit') }} ({{ flag_slugify(status['labelon']) }})
</h1>
<form id="fileupload" class="form-horizontal" target="_self" enctype="multipart/form-data" method="post" action="{{ path('database_submit_statusbit', { 'databox_id' : app['request'].get('databox_id'), 'bit' : app['request'].get('bit') }) }}">

View File

@@ -4,6 +4,7 @@ namespace Alchemy\Tests\Phrasea\Authentication\Phrasea;
use Alchemy\Phrasea\Authentication\Phrasea\FailureManager;
use Alchemy\Phrasea\Model\Entities\AuthFailure;
use Alchemy\Phrasea\Model\Repositories\AuthFailureRepository;
use Gedmo\Timestampable\TimestampableListener;
use Symfony\Component\HttpFoundation\Request;
@@ -18,7 +19,7 @@ class FailureManagerTest extends \PhraseanetTestCase
*/
public function testSaveFailure()
{
$repo = $this->getRepo();
$repo = $this->createAuthFailureRepositoryMock();
$em = $this->createEntityManagerMock();
$recaptcha = $this->getReCaptchaMock(null);
@@ -31,8 +32,8 @@ class FailureManagerTest extends \PhraseanetTestCase
->will($this->returnValue($ip));
$oldFailures = [
$this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure'),
$this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure')
$this->getMock(AuthFailure::class),
$this->getMock(AuthFailure::class)
];
$repo->expects($this->once())
@@ -41,12 +42,12 @@ class FailureManagerTest extends \PhraseanetTestCase
$em->expects($this->exactly(count($oldFailures)))
->method('remove')
->with($this->isInstanceOf('Alchemy\Phrasea\Model\Entities\AuthFailure'));
->with($this->isInstanceOf(AuthFailure::class));
$catchFailure = null;
$em->expects($this->once())
->method('persist')
->with($this->isInstanceOf('Alchemy\Phrasea\Model\Entities\AuthFailure'))
->with($this->isInstanceOf(AuthFailure::class))
->will($this->returnCallback(function ($failure) use (&$catchFailure) {
$catchFailure = $failure;
}));
@@ -54,6 +55,8 @@ class FailureManagerTest extends \PhraseanetTestCase
$manager = new FailureManager($repo, $em, $recaptcha, 9);
$manager->saveFailure($username, $request);
/** @var null|AuthFailure $catchFailure */
$this->assertInstanceOf(AuthFailure::class, $catchFailure);
$this->assertEquals($ip, $catchFailure->getIp());
$this->assertEquals(true, $catchFailure->getLocked());
$this->assertEquals($username, $catchFailure->getUsername());
@@ -64,7 +67,7 @@ class FailureManagerTest extends \PhraseanetTestCase
*/
public function testCheckFailures()
{
$repo = $this->getRepo();
$repo = $this->createAuthFailureRepositoryMock();
$em = $this->createEntityManagerMock();
$recaptcha = $this->getReCaptchaMock(null);
$request = $this->getRequestMock();
@@ -86,7 +89,7 @@ class FailureManagerTest extends \PhraseanetTestCase
*/
public function testCheckFailuresLessThan9()
{
$repo = $this->getRepo();
$repo = $this->createAuthFailureRepositoryMock();
$em = $this->createEntityManagerMock();
$recaptcha = $this->getReCaptchaMock(null);
$request = $this->getRequestMock();
@@ -94,7 +97,7 @@ class FailureManagerTest extends \PhraseanetTestCase
$username = 'romainneutron';
$oldFailures = $this->ArrayIze(function () {
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
return $this->getMock(AuthFailure::class);
}, 8);
$repo->expects($this->once())
@@ -110,7 +113,7 @@ class FailureManagerTest extends \PhraseanetTestCase
*/
public function testCheckFailuresMoreThan9WithoutCaptcha()
{
$repo = $this->getRepo();
$repo = $this->createAuthFailureRepositoryMock();
$em = $this->createEntityManagerMock();
$recaptcha = $this->getReCaptchaMock(false);
$request = $this->getRequestMock();
@@ -118,7 +121,7 @@ class FailureManagerTest extends \PhraseanetTestCase
$username = 'romainneutron';
$oldFailures = $this->ArrayIze(function () {
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
return $this->getMock(AuthFailure::class);
}, 10);
$repo->expects($this->once())
@@ -134,7 +137,7 @@ class FailureManagerTest extends \PhraseanetTestCase
*/
public function testCheckFailuresMoreThan9WithCorrectCaptcha()
{
$repo = $this->getRepo();
$repo = $this->createAuthFailureRepositoryMock();
$em = $this->createEntityManagerMock();
$request = $this->getRequestMock();
$recaptcha = $this->getReCaptchaMock(true, $request, true);
@@ -142,7 +145,7 @@ class FailureManagerTest extends \PhraseanetTestCase
$username = 'romainneutron';
$oldFailures = $this->ArrayIze(function () {
$failure = $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
$failure = $this->getMock(AuthFailure::class);
$failure->expects($this->once())
->method('setLocked')
->with($this->equalTo(false));
@@ -164,7 +167,7 @@ class FailureManagerTest extends \PhraseanetTestCase
*/
public function testCheckFailuresMoreThan9WithIncorrectCaptcha()
{
$repo = $this->getRepo();
$repo = $this->createAuthFailureRepositoryMock();
$em = $this->createEntityManagerMock();
$request = $this->getRequestMock();
$recaptcha = $this->getReCaptchaMock(true, $request, false);
@@ -172,7 +175,7 @@ class FailureManagerTest extends \PhraseanetTestCase
$username = 'romainneutron';
$oldFailures = $this->ArrayIze(function () {
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
return $this->getMock(AuthFailure::class);
}, 10);
$repo->expects($this->once())
@@ -185,7 +188,7 @@ class FailureManagerTest extends \PhraseanetTestCase
public function testCheckFailuresTrialsIsConfigurableUnderThreshold()
{
$repo = $this->getRepo();
$repo = $this->createAuthFailureRepositoryMock();
$em = $this->createEntityManagerMock();
$recaptcha = $this->getReCaptchaMock(null);
$request = $this->getRequestMock();
@@ -193,7 +196,7 @@ class FailureManagerTest extends \PhraseanetTestCase
$username = 'romainneutron';
$oldFailures = $this->ArrayIze(function () {
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
return $this->getMock(AuthFailure::class);
}, 2);
$repo->expects($this->once())
@@ -207,10 +210,9 @@ class FailureManagerTest extends \PhraseanetTestCase
public function testTrialsIsConfigurable()
{
$em = $this->createEntityManagerMock();
$recaptcha = $this->getReCaptchaMock(null);
$manager = new FailureManager($this->createEntityRepositoryMock(), $em, $recaptcha, 2);
$manager = new FailureManager($this->createAuthFailureRepositoryMock(), $em, $recaptcha, 2);
$this->assertEquals(2, $manager->getTrials());
}
@@ -220,7 +222,7 @@ class FailureManagerTest extends \PhraseanetTestCase
*/
public function testCheckFailuresTrialsIsConfigurableOverThreshold()
{
$repo = $this->getRepo();
$repo = $this->createAuthFailureRepositoryMock();
$em = $this->createEntityManagerMock();
$request = $this->getRequestMock();
$recaptcha = $this->getReCaptchaMock(true, $request, false);
@@ -228,7 +230,7 @@ class FailureManagerTest extends \PhraseanetTestCase
$username = 'romainneutron';
$oldFailures = $this->ArrayIze(function () {
return $this->getMock('Alchemy\Phrasea\Model\Entities\AuthFailure');
return $this->getMock(AuthFailure::class);
}, 3);
$repo->expects($this->once())
@@ -311,14 +313,17 @@ class FailureManagerTest extends \PhraseanetTestCase
private function getRequestMock()
{
return $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')
return $this->getMockBuilder(Request::class)
->disableOriginalConstructor()
->getMock();
}
private function getRepo()
/**
* @return AuthFailureRepository|\PHPUnit_Framework_MockObject_MockObject
*/
private function createAuthFailureRepositoryMock()
{
return $this->getMockBuilder('Alchemy\Phrasea\Model\Repositories\AuthFailureRepository')
return $this->getMockBuilder(AuthFailureRepository::class)
->disableOriginalConstructor()
->getMock();
}

View File

@@ -2,11 +2,26 @@
namespace Alchemy\Tests\Phrasea\Core\Provider;
use Alchemy\Phrasea\Authentication\AccountCreator;
use Alchemy\Phrasea\Authentication\Authenticator;
use Alchemy\Phrasea\Authentication\Manager as AuthenticationManager;
use Alchemy\Phrasea\Authentication\PersistentCookie\Manager as PersistentCookieManager;
use Alchemy\Phrasea\Authentication\Phrasea\FailureHandledNativeAuthentication;
use Alchemy\Phrasea\Authentication\Phrasea\FailureManager;
use Alchemy\Phrasea\Authentication\Phrasea\NativeAuthentication;
use Alchemy\Phrasea\Authentication\Phrasea\OldPasswordEncoder;
use Alchemy\Phrasea\Authentication\Phrasea\PasswordAuthenticationInterface;
use Alchemy\Phrasea\Authentication\Phrasea\PasswordEncoder;
use Alchemy\Phrasea\Authentication\Provider\Factory;
use Alchemy\Phrasea\Authentication\ProvidersCollection;
use Alchemy\Phrasea\Authentication\SuggestionFinder;
use Alchemy\Phrasea\Core\Provider\RepositoriesServiceProvider;
use Alchemy\Phrasea\Core\Provider\TokensServiceProvider;
use Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider;
use Alchemy\Phrasea\Core\Provider\ConfigurationServiceProvider;
use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\Model\Repositories\AuthFailureRepository;
use Alchemy\Phrasea\Model\Repositories\UserRepository;
use Neutron\ReCaptcha\ReCaptcha;
/**
* @group functional
@@ -19,59 +34,59 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
{
return [
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'authentication',
'Alchemy\\Phrasea\\Authentication\\Authenticator',
Authenticator::class,
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'authentication.persistent-manager',
'Alchemy\Phrasea\Authentication\PersistentCookie\Manager'
PersistentCookieManager::class
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'authentication.suggestion-finder',
'Alchemy\Phrasea\Authentication\SuggestionFinder'
SuggestionFinder::class
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'authentication.providers.factory',
'Alchemy\Phrasea\Authentication\Provider\Factory'
Factory::class
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'authentication.providers',
'Alchemy\Phrasea\Authentication\ProvidersCollection'
ProvidersCollection::class
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'authentication.manager',
'Alchemy\Phrasea\Authentication\Manager'
AuthenticationManager::class
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'auth.password-encoder',
'Alchemy\Phrasea\Authentication\Phrasea\PasswordEncoder'
PasswordEncoder::class
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'auth.old-password-encoder',
'Alchemy\Phrasea\Authentication\Phrasea\OldPasswordEncoder'
OldPasswordEncoder::class
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'auth.native.failure-manager',
'Alchemy\Phrasea\Authentication\Phrasea\FailureManager'
FailureManager::class
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'auth.native',
'Alchemy\Phrasea\Authentication\Phrasea\PasswordAuthenticationInterface'
PasswordAuthenticationInterface::class
],
[
'Alchemy\Phrasea\Core\Provider\AuthenticationManagerServiceProvider',
AuthenticationManagerServiceProvider::class,
'authentication.providers.account-creator',
'Alchemy\Phrasea\Authentication\AccountCreator'
AccountCreator::class
],
];
}
@@ -83,9 +98,7 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
$app['conf']->set(['authentication', 'captcha', 'trials-before-display'], 42);
//$app['orm.em'] = $this->createEntityManagerMock();
$app['recaptcha'] = $this->getMockBuilder('Neutron\ReCaptcha\ReCaptcha')
->disableOriginalConstructor()
->getMock();
$app['recaptcha'] = $this->createReCaptchaMock();
$manager = $app['auth.native.failure-manager'];
$this->assertEquals(42, $manager->getTrials());
@@ -93,9 +106,10 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
public function testFailureAccountCreator()
{
self::$DI['app']->register(new ConfigurationServiceProvider());
self::$DI['app']['conf']->set(['authentication', 'auto-create'], ['templates' => []]);
self::$DI['app']['authentication.providers.account-creator'];
$app = $this->getApplication();
$app->register(new ConfigurationServiceProvider());
$app['conf']->set(['authentication', 'auto-create'], ['templates' => []]);
$app['authentication.providers.account-creator'];
}
public function testAuthNativeWithCaptchaEnabled()
@@ -111,12 +125,12 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
$app['orm.em'] = $this->createEntityManagerMock();
$app['repo.users'] = $this->createUserRepositoryMock();
$app['repo.auth-failures'] = $this->createEntityRepositoryMock();
$app['recaptcha'] = $this->getMockBuilder('Neutron\ReCaptcha\ReCaptcha')
$app['repo.auth-failures'] = $this->getMockBuilder(AuthFailureRepository::class)
->disableOriginalConstructor()
->getMock();
$app['recaptcha'] = $this->createReCaptchaMock();
$this->assertInstanceOf('Alchemy\Phrasea\Authentication\Phrasea\FailureHandledNativeAuthentication', $app['auth.native']);
$this->assertInstanceOf(FailureHandledNativeAuthentication::class, $app['auth.native']);
}
public function testAuthNativeWithCaptchaDisabled()
@@ -131,26 +145,25 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
$app['orm.em'] = $this->createEntityManagerMock();
$app['repo.users'] = $this->createUserRepositoryMock();
$app['recaptcha'] = $this->getMockBuilder('Neutron\ReCaptcha\ReCaptcha')
->disableOriginalConstructor()
->getMock();
$app['recaptcha'] = $this->createReCaptchaMock();
$this->assertInstanceOf('Alchemy\Phrasea\Authentication\Phrasea\NativeAuthentication', $app['auth.native']);
$this->assertInstanceOf(NativeAuthentication::class, $app['auth.native']);
}
public function testAccountCreator()
{
$template1 = $user = self::$DI['app']['manipulator.user']->createTemplate('template1', self::$DI['user']);
$template2 = $user = self::$DI['app']['manipulator.user']->createTemplate('template2', self::$DI['user']);
$app = $this->getApplication();
$template1 = $user = $app['manipulator.user']->createTemplate('template1', self::$DI['user']);
$template2 = $user = $app['manipulator.user']->createTemplate('template2', self::$DI['user']);
self::$DI['app']['conf']->set(['authentication', 'auto-create'], ['templates' => [$template1->getId(), $template2->getId()]]);
$app['conf']->set(['authentication', 'auto-create'], ['templates' => [$template1->getId(), $template2->getId()]]);
$this->assertEquals([$template1->getLogin(), $template2->getLogin()], array_map(function ($u) {
return $u->getLogin();
}, self::$DI['app']['authentication.providers.account-creator']->getTemplates()));
$this->assertEquals([$template1->getLogin(), $template2->getLogin()], array_map(function (User $user) {
return $user->getLogin();
}, $app['authentication.providers.account-creator']->getTemplates()));
$this->removeUser(self::$DI['app'], $template1);
$this->removeUser(self::$DI['app'], $template2);
$this->removeUser($app, $template1);
$this->removeUser($app, $template2);
}
private function createUserRepositoryMock()
@@ -159,4 +172,14 @@ class AuthenticationManagerServiceProviderTest extends ServiceProviderTestCase
->disableOriginalConstructor()
->getMock();
}
/**
* @return ReCaptcha|\PHPUnit_Framework_MockObject_MockObject
*/
protected function createReCaptchaMock()
{
return $this->getMockBuilder(ReCaptcha::class)
->disableOriginalConstructor()
->getMock();
}
}

View File

@@ -2,16 +2,33 @@
namespace Alchemy\Tests\Phrasea\TaskManager\Job;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\TaskManager\Job\AbstractJob;
use Alchemy\Phrasea\TaskManager\Job\EmptyCollectionJob;
use Prophecy\Prophecy\ObjectProphecy;
use Symfony\Component\Translation\TranslatorInterface;
/**
* @group functional
* @group legacy
*/
class EmptyCollectionJobTest extends JobTestCase
class EmptyCollectionJobTest extends \PHPUnit_Framework_TestCase
{
protected function getJob()
/**
* @var ObjectProphecy
*/
private $translator;
/**
* @var EmptyCollectionJob
*/
private $sut;
protected function setUp()
{
return new EmptyCollectionJob($this->createTranslatorMock());
$this->translator = $this->prophesize(TranslatorInterface::class);
$this->sut = new EmptyCollectionJob($this->translator->reveal());
}
public function testItExtendsAbstractJob()
{
$this->assertInstanceOf(AbstractJob::class, $this->sut);
}
}

View File

@@ -344,6 +344,11 @@ abstract class PhraseanetTestCase extends WebTestCase
return $cli;
}
/**
* @param null|string $path
* @param string $environment
* @return Application
*/
protected function loadApp($path = null, $environment = Application::ENV_TEST)
{
if (null !== $path) {