From 684f5f9e41c23c34580055403526405cdfdcf37a Mon Sep 17 00:00:00 2001 From: Richard Vodden Date: Sun, 25 Mar 2018 19:41:26 +0100 Subject: [PATCH 01/31] WIP - moving to another machine --- composer.lock | 2 +- phpstan.neon | 2 +- src/Driver/BaseDriver.php | 2 +- src/Driver/{ => BlackBox}/BlackboxDriver.php | 4 +- src/Driver/Element/BaseElement.php | 74 ++----- .../Element/DatabaseElementInterface.php | 24 +++ src/Driver/Element/ElementInterface.php | 37 ---- src/Driver/Element/Wpphp/DatabaseElement.php | 184 ------------------ .../Wpcli => Wpcli/Element}/CacheElement.php | 4 +- .../Element}/CommentElement.php | 8 +- .../Element}/ContentElement.php | 18 +- .../Element}/DatabaseElement.php | 48 +---- .../Wpcli => Wpcli/Element}/PluginElement.php | 4 +- .../Wpcli => Wpcli/Element}/TermElement.php | 8 +- .../Wpcli => Wpcli/Element}/ThemeElement.php | 4 +- .../Wpcli => Wpcli/Element}/UserElement.php | 4 +- .../Wpcli => Wpcli/Element}/WidgetElement.php | 4 +- src/Driver/{ => Wpcli}/WpcliDriver.php | 3 +- .../Wpphp => Wpphp/Element}/CacheElement.php | 2 +- .../Element}/CommentElement.php | 2 +- .../Element}/ContentElement.php | 2 +- src/Driver/Wpphp/Element/DatabaseElement.php | 129 ++++++++++++ .../Wpphp => Wpphp/Element}/PluginElement.php | 2 +- .../Wpphp => Wpphp/Element}/TermElement.php | 2 +- .../Wpphp => Wpphp/Element}/ThemeElement.php | 2 +- .../Wpphp => Wpphp/Element}/UserElement.php | 2 +- .../Wpphp => Wpphp/Element}/WidgetElement.php | 2 +- src/Driver/{ => Wpphp}/WpphpDriver.php | 3 +- src/ServiceContainer/config/drivers/wpcli.yml | 62 +++--- src/ServiceContainer/config/drivers/wpphp.yml | 63 +++--- 30 files changed, 283 insertions(+), 424 deletions(-) rename src/Driver/{ => BlackBox}/BlackboxDriver.php (64%) create mode 100644 src/Driver/Element/DatabaseElementInterface.php delete mode 100644 src/Driver/Element/Wpphp/DatabaseElement.php rename src/Driver/{Element/Wpcli => Wpcli/Element}/CacheElement.php (81%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/CommentElement.php (85%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/ContentElement.php (85%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/DatabaseElement.php (58%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/PluginElement.php (88%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/TermElement.php (84%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/ThemeElement.php (83%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/UserElement.php (96%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/WidgetElement.php (93%) rename src/Driver/{ => Wpcli}/WpcliDriver.php (97%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/CacheElement.php (90%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/CommentElement.php (96%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/ContentElement.php (97%) create mode 100644 src/Driver/Wpphp/Element/DatabaseElement.php rename src/Driver/{Element/Wpphp => Wpphp/Element}/PluginElement.php (96%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/TermElement.php (96%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/ThemeElement.php (93%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/UserElement.php (97%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/WidgetElement.php (97%) rename src/Driver/{ => Wpphp}/WpphpDriver.php (95%) diff --git a/composer.lock b/composer.lock index b2b12fc4..29e69262 100644 --- a/composer.lock +++ b/composer.lock @@ -2198,7 +2198,7 @@ "email": "sven.eisenschmidt@gmail.com" }, { - "name": "Javier Gómez", + "name": "Javier Gomez", "email": "javier.gomez@community.joomla.org" } ], diff --git a/phpstan.neon b/phpstan.neon index 9246f2ac..c95d4469 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: excludes_analyse: # These reference global WP functions. - - %rootDir%/../../../src/Driver/Element/Wpphp/* + - %rootDir%/../../../src/Driver/Wpphp/Element/* - src/Driver/WpphpDriver.php diff --git a/src/Driver/BaseDriver.php b/src/Driver/BaseDriver.php index ec4547da..e770f8dc 100644 --- a/src/Driver/BaseDriver.php +++ b/src/Driver/BaseDriver.php @@ -34,7 +34,7 @@ abstract class BaseDriver implements DriverInterface * @var \PaulGibbs\WordpressBehatExtension\Driver\Element\ElementInterface[] */ protected $elements = []; - + /** * Expose $elements as public properties. * diff --git a/src/Driver/BlackboxDriver.php b/src/Driver/BlackBox/BlackboxDriver.php similarity index 64% rename from src/Driver/BlackboxDriver.php rename to src/Driver/BlackBox/BlackboxDriver.php index 6e4fe993..3c6d3b99 100644 --- a/src/Driver/BlackboxDriver.php +++ b/src/Driver/BlackBox/BlackboxDriver.php @@ -1,6 +1,8 @@ drivers = $drivers; - } + private $driver; /** - * Create an item for this element. - * - * @param array $args Data used to create an object. - * - * @return mixed The new item. - * - * @throws UnsupportedDriverActionException - */ - public function create($args) - { - throw new UnsupportedDriverActionException(sprintf('use the %s element create method', static::class)); - } - - /** - * Retrieve an item for this element. - * - * @param int|string $id Object ID. - * @param array $args Optional data used to fetch an object. - * - * @throws UnsupportedDriverActionException - * - * @return mixed The item. - */ - public function get($id, $args = []) - { - throw new UnsupportedDriverActionException(sprintf('use the %s element get method', static::class)); - } - - /** - * Update an item for this element. - * - * @param int|string $id Object ID. - * @param array $args Optional data used to update an object. + * Constructor. * - * @throws UnsupportedDriverActionException + * @param DriverInterface $drivers */ - public function update($id, $args = []) + public function __construct(DriverInterface $driver) { - throw new UnsupportedDriverActionException(sprintf('use the %s element update method', static::class)); + $this->driver = $driver; } - - /** - * Delete an item for this element. - * - * @param int|string $id Object ID. - * @param array $args Optional data used to delete an object. - * - * @throws UnsupportedDriverActionException - */ - public function delete($id, $args = []) + + protected function getDriver() : DriverInterface { - throw new UnsupportedDriverActionException(sprintf('use the %s element delete method', static::class)); + return $this->driver; } } diff --git a/src/Driver/Element/DatabaseElementInterface.php b/src/Driver/Element/DatabaseElementInterface.php new file mode 100644 index 00000000..72a6abe9 --- /dev/null +++ b/src/Driver/Element/DatabaseElementInterface.php @@ -0,0 +1,24 @@ + ['pipe', 'w'], - 2 => ['pipe', 'w'], - ), - $pipes - ); - - $stdout = trim(stream_get_contents($pipes[1])); - $stderr = trim(stream_get_contents($pipes[2])); - fclose($pipes[1]); - fclose($pipes[2]); - $exit_code = proc_close($proc); - putenv('MYSQL_PWD=' . $old_pwd); - - // Sometimes the error message is in stderr. - if (! $stdout && $stderr) { - $stdout = $stderr; - } - - if ($exit_code || strpos($stdout, 'Warning: ') === 0 || strpos($stdout, 'Error: ') === 0) { - throw new RuntimeException( - sprintf( - "[W606] Could not export database in method %1\$s(): \n\n%2\$s.\n(%3\$s)", - debug_backtrace()[1]['function'], - $stdout, - $exit_code - ) - ); - } - - return $path; - } - - /** - * Import site database. - * - * @param int $id Not used. - * @param array $args - */ - public function update($id, $args = []) - { - $bin = ''; - $command_args = sprintf( - '--no-defaults --no-auto-rehash --host=%1$s --user=%2$s --database=%3$s --execute=%4$s', - DB_HOST, - DB_USER, - DB_NAME, - escapeshellarg(sprintf( - 'SET autocommit = 0; SET unique_checks = 0; SET foreign_key_checks = 0; SOURCE %1$s; COMMIT;', - $args['path'] - )) - ); - - $old_pwd = getenv('MYSQL_PWD'); - putenv('MYSQL_PWD=' . DB_PASSWORD); - - // Support Windows. - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $bin = '/usr/bin/env '; - } - - // Import DB via mysql-cli. - $proc = proc_open( - "{$bin}mysql {$command_args}", - array( - 1 => ['pipe', 'w'], - 2 => ['pipe', 'w'], - ), - $pipes - ); - - $stdout = trim(stream_get_contents($pipes[1])); - $stderr = trim(stream_get_contents($pipes[2])); - fclose($pipes[1]); - fclose($pipes[2]); - $exit_code = proc_close($proc); - putenv('MYSQL_PWD=' . $old_pwd); - - // Sometimes the error message is in stderr. - if (! $stdout && $stderr) { - $stdout = $stderr; - } - - if ($exit_code || strpos($stdout, 'Warning: ') === 0 || strpos($stdout, 'Error: ') === 0) { - throw new RuntimeException( - sprintf( - "[W607] Could not import database in method %1\$s(): \n\n%2\$s.\n(%3\$s)", - debug_backtrace()[1]['function'], - $stdout, - $exit_code - ) - ); - } - - /* - * clear the cache after restoration - this is probably only necessary - * because of some kind of global state issue - the WPCLI driver doensn't - * need it. There is some discussion about it here: - * - * https://github.com/paulgibbs/behat-wordpress-extension/pull/150 - */ - \wp_cache_flush(); - } - - - /* - * Convenience methods. - */ - - /** - * Alias of get(). - * - * @see get() - * - * @param int $id Not used. - * @param array $args - * - * @return string Path to the export file. - */ - public function export($id, $args = []) - { - return $this->get($id, $args); - } - - /** - * Alias of update(). - * - * @see update() - * - * @param int $id Not used. - * @param array $args - */ - public function import($id, $args = []) - { - $this->update($id, $args); - } -} diff --git a/src/Driver/Element/Wpcli/CacheElement.php b/src/Driver/Wpcli/Element/CacheElement.php similarity index 81% rename from src/Driver/Element/Wpcli/CacheElement.php rename to src/Driver/Wpcli/Element/CacheElement.php index a82db359..a6db2292 100644 --- a/src/Driver/Element/Wpcli/CacheElement.php +++ b/src/Driver/Wpcli/Element/CacheElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('cache', 'flush'); + $this->getDriver()->wpcli('cache', 'flush'); } diff --git a/src/Driver/Element/Wpcli/CommentElement.php b/src/Driver/Wpcli/Element/CommentElement.php similarity index 85% rename from src/Driver/Element/Wpcli/CommentElement.php rename to src/Driver/Wpcli/Element/CommentElement.php index d58f8d9f..d8a83b97 100644 --- a/src/Driver/Element/Wpcli/CommentElement.php +++ b/src/Driver/Wpcli/Element/CommentElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('comment', 'create', $wpcli_args)['stdout']; + $comment_id = (int) $this->getDriver()->wpcli('comment', 'create', $wpcli_args)['stdout']; return $this->get($comment_id); } @@ -55,7 +55,7 @@ public function get($id, $args = []) ); array_unshift($wpcli_args, $id, '--format=json'); - $comment = $this->drivers->getDriver()->wpcli('comment', 'get', $wpcli_args)['stdout']; + $comment = $this->getDriver()->wpcli('comment', 'get', $wpcli_args)['stdout']; $comment = json_decode($comment); if (! $comment) { @@ -80,6 +80,6 @@ public function delete($id, $args = []) array_unshift($wpcli_args, $id); - $this->drivers->getDriver()->wpcli('comment', 'delete', $wpcli_args); + $this->getDriver()->wpcli('comment', 'delete', $wpcli_args); } } diff --git a/src/Driver/Element/Wpcli/ContentElement.php b/src/Driver/Wpcli/Element/ContentElement.php similarity index 85% rename from src/Driver/Element/Wpcli/ContentElement.php rename to src/Driver/Wpcli/Element/ContentElement.php index 788c7432..0f92e55b 100644 --- a/src/Driver/Element/Wpcli/ContentElement.php +++ b/src/Driver/Wpcli/Element/ContentElement.php @@ -1,10 +1,10 @@ drivers->getDriver()->wpcli('post', 'create', $wpcli_args)['stdout']; + $post_id = (int) $this->getDriver()->wpcli('post', 'create', $wpcli_args)['stdout']; // Apply taxonomy values. if ($tax_args) { @@ -70,7 +70,7 @@ public function create($args) escapeshellarg($split_term), ]; - $this->drivers->getDriver()->wpcli('post', 'term add', $args); + $this->getDriver()->wpcli('post', 'term add', $args); } } } @@ -84,7 +84,7 @@ public function create($args) escapeshellarg($meta_value), ]; - $this->drivers->getDriver()->wpcli('post', 'meta update', $args)['stdout']; + $this->getDriver()->wpcli('post', 'meta update', $args)['stdout']; } } @@ -108,7 +108,7 @@ public function get($id, $args = []) // Support fetching via arbitrary field. if (! is_numeric($id)) { $wpcli_args = ['--fields=ID,url', "--{$args['by']}=" . escapeshellarg($id), '--post_type=any', '--format=json']; - $result = json_decode($this->drivers->getDriver()->wpcli('post', 'list', $wpcli_args)['stdout']); + $result = json_decode($this->getDriver()->wpcli('post', 'list', $wpcli_args)['stdout']); if (empty($result)) { throw new UnexpectedValueException(sprintf('[W501] Could not find post with ID %d', $id)); @@ -128,7 +128,7 @@ public function get($id, $args = []) ); array_unshift($wpcli_args, $id, '--format=json'); - $post = $this->drivers->getDriver()->wpcli('post', 'get', $wpcli_args)['stdout']; + $post = $this->getDriver()->wpcli('post', 'get', $wpcli_args)['stdout']; $post = json_decode($post); if (! $post) { @@ -137,7 +137,7 @@ public function get($id, $args = []) if (! $url) { $wpcli_args = ['--post__in=' . $post->ID, '--fields=url', '--post_type=any', '--format=json']; - $result = json_decode($this->drivers->getDriver()->wpcli('post', 'list', $wpcli_args)['stdout']); + $result = json_decode($this->getDriver()->wpcli('post', 'list', $wpcli_args)['stdout']); $url = $result[0]->url; } @@ -161,6 +161,6 @@ public function delete($id, $args = []) array_unshift($wpcli_args, $id); - $this->drivers->getDriver()->wpcli('post', 'delete', $wpcli_args); + $this->getDriver()->wpcli('post', 'delete', $wpcli_args); } } diff --git a/src/Driver/Element/Wpcli/DatabaseElement.php b/src/Driver/Wpcli/Element/DatabaseElement.php similarity index 58% rename from src/Driver/Element/Wpcli/DatabaseElement.php rename to src/Driver/Wpcli/Element/DatabaseElement.php index 81ea86df..de3f499e 100644 --- a/src/Driver/Element/Wpcli/DatabaseElement.php +++ b/src/Driver/Wpcli/Element/DatabaseElement.php @@ -1,15 +1,16 @@ drivers->getDriver()->wpcli('db', 'export', $wpcli_args)['stdout']; + $path = $this->getDriver()->wpcli('db', 'export', $wpcli_args)['stdout']; if (! $path) { throw new RuntimeException('[W502] Could not export database'); } @@ -44,9 +45,9 @@ public function get($id, $args = []) * @param int $id Not used. * @param array $args */ - public function update($id, $args = []) + public function import($id, $args = []) { - $this->drivers->getDriver()->wpcli('db', 'import', [$args['path']]); + $this->getDriver()->wpcli('db', 'import', [$args['path']]); /* * The WPPHP driver needs the WP cache flushed at this point. However @@ -57,37 +58,4 @@ public function update($id, $args = []) * https://github.com/paulgibbs/behat-wordpress-extension/pull/150 */ } - - - /* - * Convenience methods. - */ - - /** - * Alias of get(). - * - * @see get() - * - * @param int $id Not used. - * @param array $args - * - * @return string Path to the export file. - */ - public function export($id, $args = []) - { - return $this->get($id, $args); - } - - /** - * Alias of update(). - * - * @see update() - * - * @param int $id Not used. - * @param array $args - */ - public function import($id, $args = []) - { - $this->update($id, $args); - } } diff --git a/src/Driver/Element/Wpcli/PluginElement.php b/src/Driver/Wpcli/Element/PluginElement.php similarity index 88% rename from src/Driver/Element/Wpcli/PluginElement.php rename to src/Driver/Wpcli/Element/PluginElement.php index bc17ff82..d713d6dc 100644 --- a/src/Driver/Element/Wpcli/PluginElement.php +++ b/src/Driver/Wpcli/Element/PluginElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('plugin', $args['status'], [$id]); + $this->getDriver()->wpcli('plugin', $args['status'], [$id]); } diff --git a/src/Driver/Element/Wpcli/TermElement.php b/src/Driver/Wpcli/Element/TermElement.php similarity index 84% rename from src/Driver/Element/Wpcli/TermElement.php rename to src/Driver/Wpcli/Element/TermElement.php index 43637a88..0e658812 100644 --- a/src/Driver/Element/Wpcli/TermElement.php +++ b/src/Driver/Wpcli/Element/TermElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('term', 'create', $wpcli_args)['stdout']; + $term_id = (int) $this->getDriver()->wpcli('term', 'create', $wpcli_args)['stdout']; return $this->get($term_id); } @@ -56,7 +56,7 @@ public function get($id, $args = []) ); array_unshift($wpcli_args, $args['taxonomy'], $id, '--format=json'); - $term = $this->drivers->getDriver()->wpcli('term', 'get', $wpcli_args)['stdout']; + $term = $this->getDriver()->wpcli('term', 'get', $wpcli_args)['stdout']; $term = json_decode($term); if (! $term) { @@ -79,6 +79,6 @@ public function delete($id, $args = []) $id, ]; - $this->drivers->getDriver()->wpcli('term', 'delete', $wpcli_args); + $this->getDriver()->wpcli('term', 'delete', $wpcli_args); } } diff --git a/src/Driver/Element/Wpcli/ThemeElement.php b/src/Driver/Wpcli/Element/ThemeElement.php similarity index 83% rename from src/Driver/Element/Wpcli/ThemeElement.php rename to src/Driver/Wpcli/Element/ThemeElement.php index 39aa8b67..0eee0624 100644 --- a/src/Driver/Element/Wpcli/ThemeElement.php +++ b/src/Driver/Wpcli/Element/ThemeElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('theme', 'activate', [$id]); + $this->getDriver()->wpcli('theme', 'activate', [$id]); } diff --git a/src/Driver/Element/Wpcli/UserElement.php b/src/Driver/Wpcli/Element/UserElement.php similarity index 96% rename from src/Driver/Element/Wpcli/UserElement.php rename to src/Driver/Wpcli/Element/UserElement.php index 391c33a5..ee487240 100644 --- a/src/Driver/Element/Wpcli/UserElement.php +++ b/src/Driver/Wpcli/Element/UserElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('user', 'delete', $wpcli_args); + $this->getDriver()->wpcli('user', 'delete', $wpcli_args); } } diff --git a/src/Driver/Element/Wpcli/WidgetElement.php b/src/Driver/Wpcli/Element/WidgetElement.php similarity index 93% rename from src/Driver/Element/Wpcli/WidgetElement.php rename to src/Driver/Wpcli/Element/WidgetElement.php index 79352213..a307235d 100644 --- a/src/Driver/Element/Wpcli/WidgetElement.php +++ b/src/Driver/Wpcli/Element/WidgetElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('widget', 'add', $wpcli_args); + $this->getDriver()->wpcli('widget', 'add', $wpcli_args); } /** diff --git a/src/Driver/WpcliDriver.php b/src/Driver/Wpcli/WpcliDriver.php similarity index 97% rename from src/Driver/WpcliDriver.php rename to src/Driver/Wpcli/WpcliDriver.php index b69998b7..7998a6d1 100644 --- a/src/Driver/WpcliDriver.php +++ b/src/Driver/Wpcli/WpcliDriver.php @@ -1,7 +1,8 @@ [ + 'pipe', + 'w' + ], + 2 => [ + 'pipe', + 'w' + ] + ), $pipes); + + $stdout = trim(stream_get_contents($pipes[1])); + $stderr = trim(stream_get_contents($pipes[2])); + fclose($pipes[1]); + fclose($pipes[2]); + $exit_code = proc_close($proc); + putenv('MYSQL_PWD=' . $old_pwd); + + // Sometimes the error message is in stderr. + if (! $stdout && $stderr) { + $stdout = $stderr; + } + + if ($exit_code || strpos($stdout, 'Warning: ') === 0 || strpos($stdout, 'Error: ') === 0) { + throw new RuntimeException(sprintf("[W606] Could not export database in method %1\$s(): \n\n%2\$s.\n(%3\$s)", debug_backtrace()[1]['function'], $stdout, $exit_code)); + } + + return $path; + } + + /** + * Import site database. + * + * @param int $id + * Not used. + * @param array $args + */ + public function import($id, $args = []) + { + $bin = ''; + $command_args = sprintf('--no-defaults --no-auto-rehash --host=%1$s --user=%2$s --database=%3$s --execute=%4$s', DB_HOST, DB_USER, DB_NAME, escapeshellarg(sprintf('SET autocommit = 0; SET unique_checks = 0; SET foreign_key_checks = 0; SOURCE %1$s; COMMIT;', $args['path']))); + + $old_pwd = getenv('MYSQL_PWD'); + putenv('MYSQL_PWD=' . DB_PASSWORD); + + // Support Windows. + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $bin = '/usr/bin/env '; + } + + // Import DB via mysql-cli. + $proc = proc_open("{$bin}mysql {$command_args}", array( + 1 => [ + 'pipe', + 'w' + ], + 2 => [ + 'pipe', + 'w' + ] + ), $pipes); + + $stdout = trim(stream_get_contents($pipes[1])); + $stderr = trim(stream_get_contents($pipes[2])); + fclose($pipes[1]); + fclose($pipes[2]); + $exit_code = proc_close($proc); + putenv('MYSQL_PWD=' . $old_pwd); + + // Sometimes the error message is in stderr. + if (! $stdout && $stderr) { + $stdout = $stderr; + } + + if ($exit_code || strpos($stdout, 'Warning: ') === 0 || strpos($stdout, 'Error: ') === 0) { + throw new RuntimeException(sprintf("[W607] Could not import database in method %1\$s(): \n\n%2\$s.\n(%3\$s)", debug_backtrace()[1]['function'], $stdout, $exit_code)); + } + + /* + * clear the cache after restoration - this is probably only necessary + * because of some kind of global state issue - the WPCLI driver doensn't + * need it. There is some discussion about it here: + * + * https://github.com/paulgibbs/behat-wordpress-extension/pull/150 + */ + \wp_cache_flush(); + } +} diff --git a/src/Driver/Element/Wpphp/PluginElement.php b/src/Driver/Wpphp/Element/PluginElement.php similarity index 96% rename from src/Driver/Element/Wpphp/PluginElement.php rename to src/Driver/Wpphp/Element/PluginElement.php index 421243a8..ccb226e2 100644 --- a/src/Driver/Element/Wpphp/PluginElement.php +++ b/src/Driver/Wpphp/Element/PluginElement.php @@ -1,6 +1,6 @@ Date: Sun, 25 Mar 2018 19:41:26 +0100 Subject: [PATCH 02/31] WIP - moving to another machine --- composer.lock | 2 +- phpstan.neon | 2 +- src/Driver/BaseDriver.php | 2 +- src/Driver/{ => BlackBox}/BlackboxDriver.php | 4 +- src/Driver/Element/BaseElement.php | 74 ++----- .../Element/DatabaseElementInterface.php | 24 +++ src/Driver/Element/ElementInterface.php | 37 ---- src/Driver/Element/Wpphp/DatabaseElement.php | 184 ------------------ .../Wpcli => Wpcli/Element}/CacheElement.php | 4 +- .../Element}/CommentElement.php | 8 +- .../Element}/ContentElement.php | 18 +- .../Element}/DatabaseElement.php | 48 +---- .../Wpcli => Wpcli/Element}/PluginElement.php | 4 +- .../Wpcli => Wpcli/Element}/TermElement.php | 8 +- .../Wpcli => Wpcli/Element}/ThemeElement.php | 4 +- .../Wpcli => Wpcli/Element}/UserElement.php | 4 +- .../Wpcli => Wpcli/Element}/WidgetElement.php | 4 +- src/Driver/{ => Wpcli}/WpcliDriver.php | 3 +- .../Wpphp => Wpphp/Element}/CacheElement.php | 2 +- .../Element}/CommentElement.php | 2 +- .../Element}/ContentElement.php | 2 +- src/Driver/Wpphp/Element/DatabaseElement.php | 129 ++++++++++++ .../Wpphp => Wpphp/Element}/PluginElement.php | 2 +- .../Wpphp => Wpphp/Element}/TermElement.php | 2 +- .../Wpphp => Wpphp/Element}/ThemeElement.php | 2 +- .../Wpphp => Wpphp/Element}/UserElement.php | 2 +- .../Wpphp => Wpphp/Element}/WidgetElement.php | 2 +- src/Driver/{ => Wpphp}/WpphpDriver.php | 3 +- src/ServiceContainer/config/drivers/wpcli.yml | 62 +++--- src/ServiceContainer/config/drivers/wpphp.yml | 63 +++--- 30 files changed, 283 insertions(+), 424 deletions(-) rename src/Driver/{ => BlackBox}/BlackboxDriver.php (64%) create mode 100644 src/Driver/Element/DatabaseElementInterface.php delete mode 100644 src/Driver/Element/Wpphp/DatabaseElement.php rename src/Driver/{Element/Wpcli => Wpcli/Element}/CacheElement.php (81%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/CommentElement.php (85%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/ContentElement.php (85%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/DatabaseElement.php (58%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/PluginElement.php (88%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/TermElement.php (84%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/ThemeElement.php (83%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/UserElement.php (96%) rename src/Driver/{Element/Wpcli => Wpcli/Element}/WidgetElement.php (93%) rename src/Driver/{ => Wpcli}/WpcliDriver.php (97%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/CacheElement.php (90%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/CommentElement.php (96%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/ContentElement.php (97%) create mode 100644 src/Driver/Wpphp/Element/DatabaseElement.php rename src/Driver/{Element/Wpphp => Wpphp/Element}/PluginElement.php (96%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/TermElement.php (96%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/ThemeElement.php (93%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/UserElement.php (97%) rename src/Driver/{Element/Wpphp => Wpphp/Element}/WidgetElement.php (97%) rename src/Driver/{ => Wpphp}/WpphpDriver.php (95%) diff --git a/composer.lock b/composer.lock index b2b12fc4..29e69262 100644 --- a/composer.lock +++ b/composer.lock @@ -2198,7 +2198,7 @@ "email": "sven.eisenschmidt@gmail.com" }, { - "name": "Javier Gómez", + "name": "Javier Gomez", "email": "javier.gomez@community.joomla.org" } ], diff --git a/phpstan.neon b/phpstan.neon index 9246f2ac..c95d4469 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,5 @@ parameters: excludes_analyse: # These reference global WP functions. - - %rootDir%/../../../src/Driver/Element/Wpphp/* + - %rootDir%/../../../src/Driver/Wpphp/Element/* - src/Driver/WpphpDriver.php diff --git a/src/Driver/BaseDriver.php b/src/Driver/BaseDriver.php index ec4547da..e770f8dc 100644 --- a/src/Driver/BaseDriver.php +++ b/src/Driver/BaseDriver.php @@ -34,7 +34,7 @@ abstract class BaseDriver implements DriverInterface * @var \PaulGibbs\WordpressBehatExtension\Driver\Element\ElementInterface[] */ protected $elements = []; - + /** * Expose $elements as public properties. * diff --git a/src/Driver/BlackboxDriver.php b/src/Driver/BlackBox/BlackboxDriver.php similarity index 64% rename from src/Driver/BlackboxDriver.php rename to src/Driver/BlackBox/BlackboxDriver.php index 6e4fe993..3c6d3b99 100644 --- a/src/Driver/BlackboxDriver.php +++ b/src/Driver/BlackBox/BlackboxDriver.php @@ -1,6 +1,8 @@ drivers = $drivers; - } + private $driver; /** - * Create an item for this element. - * - * @param array $args Data used to create an object. - * - * @return mixed The new item. - * - * @throws UnsupportedDriverActionException - */ - public function create($args) - { - throw new UnsupportedDriverActionException(sprintf('use the %s element create method', static::class)); - } - - /** - * Retrieve an item for this element. - * - * @param int|string $id Object ID. - * @param array $args Optional data used to fetch an object. - * - * @throws UnsupportedDriverActionException - * - * @return mixed The item. - */ - public function get($id, $args = []) - { - throw new UnsupportedDriverActionException(sprintf('use the %s element get method', static::class)); - } - - /** - * Update an item for this element. - * - * @param int|string $id Object ID. - * @param array $args Optional data used to update an object. + * Constructor. * - * @throws UnsupportedDriverActionException + * @param DriverInterface $drivers */ - public function update($id, $args = []) + public function __construct(DriverInterface $driver) { - throw new UnsupportedDriverActionException(sprintf('use the %s element update method', static::class)); + $this->driver = $driver; } - - /** - * Delete an item for this element. - * - * @param int|string $id Object ID. - * @param array $args Optional data used to delete an object. - * - * @throws UnsupportedDriverActionException - */ - public function delete($id, $args = []) + + protected function getDriver() : DriverInterface { - throw new UnsupportedDriverActionException(sprintf('use the %s element delete method', static::class)); + return $this->driver; } } diff --git a/src/Driver/Element/DatabaseElementInterface.php b/src/Driver/Element/DatabaseElementInterface.php new file mode 100644 index 00000000..72a6abe9 --- /dev/null +++ b/src/Driver/Element/DatabaseElementInterface.php @@ -0,0 +1,24 @@ + ['pipe', 'w'], - 2 => ['pipe', 'w'], - ), - $pipes - ); - - $stdout = trim(stream_get_contents($pipes[1])); - $stderr = trim(stream_get_contents($pipes[2])); - fclose($pipes[1]); - fclose($pipes[2]); - $exit_code = proc_close($proc); - putenv('MYSQL_PWD=' . $old_pwd); - - // Sometimes the error message is in stderr. - if (! $stdout && $stderr) { - $stdout = $stderr; - } - - if ($exit_code || strpos($stdout, 'Warning: ') === 0 || strpos($stdout, 'Error: ') === 0) { - throw new RuntimeException( - sprintf( - "[W606] Could not export database in method %1\$s(): \n\n%2\$s.\n(%3\$s)", - debug_backtrace()[1]['function'], - $stdout, - $exit_code - ) - ); - } - - return $path; - } - - /** - * Import site database. - * - * @param int $id Not used. - * @param array $args - */ - public function update($id, $args = []) - { - $bin = ''; - $command_args = sprintf( - '--no-defaults --no-auto-rehash --host=%1$s --user=%2$s --database=%3$s --execute=%4$s', - DB_HOST, - DB_USER, - DB_NAME, - escapeshellarg(sprintf( - 'SET autocommit = 0; SET unique_checks = 0; SET foreign_key_checks = 0; SOURCE %1$s; COMMIT;', - $args['path'] - )) - ); - - $old_pwd = getenv('MYSQL_PWD'); - putenv('MYSQL_PWD=' . DB_PASSWORD); - - // Support Windows. - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $bin = '/usr/bin/env '; - } - - // Import DB via mysql-cli. - $proc = proc_open( - "{$bin}mysql {$command_args}", - array( - 1 => ['pipe', 'w'], - 2 => ['pipe', 'w'], - ), - $pipes - ); - - $stdout = trim(stream_get_contents($pipes[1])); - $stderr = trim(stream_get_contents($pipes[2])); - fclose($pipes[1]); - fclose($pipes[2]); - $exit_code = proc_close($proc); - putenv('MYSQL_PWD=' . $old_pwd); - - // Sometimes the error message is in stderr. - if (! $stdout && $stderr) { - $stdout = $stderr; - } - - if ($exit_code || strpos($stdout, 'Warning: ') === 0 || strpos($stdout, 'Error: ') === 0) { - throw new RuntimeException( - sprintf( - "[W607] Could not import database in method %1\$s(): \n\n%2\$s.\n(%3\$s)", - debug_backtrace()[1]['function'], - $stdout, - $exit_code - ) - ); - } - - /* - * clear the cache after restoration - this is probably only necessary - * because of some kind of global state issue - the WPCLI driver doensn't - * need it. There is some discussion about it here: - * - * https://github.com/paulgibbs/behat-wordpress-extension/pull/150 - */ - \wp_cache_flush(); - } - - - /* - * Convenience methods. - */ - - /** - * Alias of get(). - * - * @see get() - * - * @param int $id Not used. - * @param array $args - * - * @return string Path to the export file. - */ - public function export($id, $args = []) - { - return $this->get($id, $args); - } - - /** - * Alias of update(). - * - * @see update() - * - * @param int $id Not used. - * @param array $args - */ - public function import($id, $args = []) - { - $this->update($id, $args); - } -} diff --git a/src/Driver/Element/Wpcli/CacheElement.php b/src/Driver/Wpcli/Element/CacheElement.php similarity index 81% rename from src/Driver/Element/Wpcli/CacheElement.php rename to src/Driver/Wpcli/Element/CacheElement.php index a82db359..a6db2292 100644 --- a/src/Driver/Element/Wpcli/CacheElement.php +++ b/src/Driver/Wpcli/Element/CacheElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('cache', 'flush'); + $this->getDriver()->wpcli('cache', 'flush'); } diff --git a/src/Driver/Element/Wpcli/CommentElement.php b/src/Driver/Wpcli/Element/CommentElement.php similarity index 85% rename from src/Driver/Element/Wpcli/CommentElement.php rename to src/Driver/Wpcli/Element/CommentElement.php index d58f8d9f..d8a83b97 100644 --- a/src/Driver/Element/Wpcli/CommentElement.php +++ b/src/Driver/Wpcli/Element/CommentElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('comment', 'create', $wpcli_args)['stdout']; + $comment_id = (int) $this->getDriver()->wpcli('comment', 'create', $wpcli_args)['stdout']; return $this->get($comment_id); } @@ -55,7 +55,7 @@ public function get($id, $args = []) ); array_unshift($wpcli_args, $id, '--format=json'); - $comment = $this->drivers->getDriver()->wpcli('comment', 'get', $wpcli_args)['stdout']; + $comment = $this->getDriver()->wpcli('comment', 'get', $wpcli_args)['stdout']; $comment = json_decode($comment); if (! $comment) { @@ -80,6 +80,6 @@ public function delete($id, $args = []) array_unshift($wpcli_args, $id); - $this->drivers->getDriver()->wpcli('comment', 'delete', $wpcli_args); + $this->getDriver()->wpcli('comment', 'delete', $wpcli_args); } } diff --git a/src/Driver/Element/Wpcli/ContentElement.php b/src/Driver/Wpcli/Element/ContentElement.php similarity index 85% rename from src/Driver/Element/Wpcli/ContentElement.php rename to src/Driver/Wpcli/Element/ContentElement.php index 788c7432..0f92e55b 100644 --- a/src/Driver/Element/Wpcli/ContentElement.php +++ b/src/Driver/Wpcli/Element/ContentElement.php @@ -1,10 +1,10 @@ drivers->getDriver()->wpcli('post', 'create', $wpcli_args)['stdout']; + $post_id = (int) $this->getDriver()->wpcli('post', 'create', $wpcli_args)['stdout']; // Apply taxonomy values. if ($tax_args) { @@ -70,7 +70,7 @@ public function create($args) escapeshellarg($split_term), ]; - $this->drivers->getDriver()->wpcli('post', 'term add', $args); + $this->getDriver()->wpcli('post', 'term add', $args); } } } @@ -84,7 +84,7 @@ public function create($args) escapeshellarg($meta_value), ]; - $this->drivers->getDriver()->wpcli('post', 'meta update', $args)['stdout']; + $this->getDriver()->wpcli('post', 'meta update', $args)['stdout']; } } @@ -108,7 +108,7 @@ public function get($id, $args = []) // Support fetching via arbitrary field. if (! is_numeric($id)) { $wpcli_args = ['--fields=ID,url', "--{$args['by']}=" . escapeshellarg($id), '--post_type=any', '--format=json']; - $result = json_decode($this->drivers->getDriver()->wpcli('post', 'list', $wpcli_args)['stdout']); + $result = json_decode($this->getDriver()->wpcli('post', 'list', $wpcli_args)['stdout']); if (empty($result)) { throw new UnexpectedValueException(sprintf('[W501] Could not find post with ID %d', $id)); @@ -128,7 +128,7 @@ public function get($id, $args = []) ); array_unshift($wpcli_args, $id, '--format=json'); - $post = $this->drivers->getDriver()->wpcli('post', 'get', $wpcli_args)['stdout']; + $post = $this->getDriver()->wpcli('post', 'get', $wpcli_args)['stdout']; $post = json_decode($post); if (! $post) { @@ -137,7 +137,7 @@ public function get($id, $args = []) if (! $url) { $wpcli_args = ['--post__in=' . $post->ID, '--fields=url', '--post_type=any', '--format=json']; - $result = json_decode($this->drivers->getDriver()->wpcli('post', 'list', $wpcli_args)['stdout']); + $result = json_decode($this->getDriver()->wpcli('post', 'list', $wpcli_args)['stdout']); $url = $result[0]->url; } @@ -161,6 +161,6 @@ public function delete($id, $args = []) array_unshift($wpcli_args, $id); - $this->drivers->getDriver()->wpcli('post', 'delete', $wpcli_args); + $this->getDriver()->wpcli('post', 'delete', $wpcli_args); } } diff --git a/src/Driver/Element/Wpcli/DatabaseElement.php b/src/Driver/Wpcli/Element/DatabaseElement.php similarity index 58% rename from src/Driver/Element/Wpcli/DatabaseElement.php rename to src/Driver/Wpcli/Element/DatabaseElement.php index 81ea86df..de3f499e 100644 --- a/src/Driver/Element/Wpcli/DatabaseElement.php +++ b/src/Driver/Wpcli/Element/DatabaseElement.php @@ -1,15 +1,16 @@ drivers->getDriver()->wpcli('db', 'export', $wpcli_args)['stdout']; + $path = $this->getDriver()->wpcli('db', 'export', $wpcli_args)['stdout']; if (! $path) { throw new RuntimeException('[W502] Could not export database'); } @@ -44,9 +45,9 @@ public function get($id, $args = []) * @param int $id Not used. * @param array $args */ - public function update($id, $args = []) + public function import($id, $args = []) { - $this->drivers->getDriver()->wpcli('db', 'import', [$args['path']]); + $this->getDriver()->wpcli('db', 'import', [$args['path']]); /* * The WPPHP driver needs the WP cache flushed at this point. However @@ -57,37 +58,4 @@ public function update($id, $args = []) * https://github.com/paulgibbs/behat-wordpress-extension/pull/150 */ } - - - /* - * Convenience methods. - */ - - /** - * Alias of get(). - * - * @see get() - * - * @param int $id Not used. - * @param array $args - * - * @return string Path to the export file. - */ - public function export($id, $args = []) - { - return $this->get($id, $args); - } - - /** - * Alias of update(). - * - * @see update() - * - * @param int $id Not used. - * @param array $args - */ - public function import($id, $args = []) - { - $this->update($id, $args); - } } diff --git a/src/Driver/Element/Wpcli/PluginElement.php b/src/Driver/Wpcli/Element/PluginElement.php similarity index 88% rename from src/Driver/Element/Wpcli/PluginElement.php rename to src/Driver/Wpcli/Element/PluginElement.php index bc17ff82..d713d6dc 100644 --- a/src/Driver/Element/Wpcli/PluginElement.php +++ b/src/Driver/Wpcli/Element/PluginElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('plugin', $args['status'], [$id]); + $this->getDriver()->wpcli('plugin', $args['status'], [$id]); } diff --git a/src/Driver/Element/Wpcli/TermElement.php b/src/Driver/Wpcli/Element/TermElement.php similarity index 84% rename from src/Driver/Element/Wpcli/TermElement.php rename to src/Driver/Wpcli/Element/TermElement.php index 43637a88..0e658812 100644 --- a/src/Driver/Element/Wpcli/TermElement.php +++ b/src/Driver/Wpcli/Element/TermElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('term', 'create', $wpcli_args)['stdout']; + $term_id = (int) $this->getDriver()->wpcli('term', 'create', $wpcli_args)['stdout']; return $this->get($term_id); } @@ -56,7 +56,7 @@ public function get($id, $args = []) ); array_unshift($wpcli_args, $args['taxonomy'], $id, '--format=json'); - $term = $this->drivers->getDriver()->wpcli('term', 'get', $wpcli_args)['stdout']; + $term = $this->getDriver()->wpcli('term', 'get', $wpcli_args)['stdout']; $term = json_decode($term); if (! $term) { @@ -79,6 +79,6 @@ public function delete($id, $args = []) $id, ]; - $this->drivers->getDriver()->wpcli('term', 'delete', $wpcli_args); + $this->getDriver()->wpcli('term', 'delete', $wpcli_args); } } diff --git a/src/Driver/Element/Wpcli/ThemeElement.php b/src/Driver/Wpcli/Element/ThemeElement.php similarity index 83% rename from src/Driver/Element/Wpcli/ThemeElement.php rename to src/Driver/Wpcli/Element/ThemeElement.php index 39aa8b67..0eee0624 100644 --- a/src/Driver/Element/Wpcli/ThemeElement.php +++ b/src/Driver/Wpcli/Element/ThemeElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('theme', 'activate', [$id]); + $this->getDriver()->wpcli('theme', 'activate', [$id]); } diff --git a/src/Driver/Element/Wpcli/UserElement.php b/src/Driver/Wpcli/Element/UserElement.php similarity index 96% rename from src/Driver/Element/Wpcli/UserElement.php rename to src/Driver/Wpcli/Element/UserElement.php index 391c33a5..ee487240 100644 --- a/src/Driver/Element/Wpcli/UserElement.php +++ b/src/Driver/Wpcli/Element/UserElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('user', 'delete', $wpcli_args); + $this->getDriver()->wpcli('user', 'delete', $wpcli_args); } } diff --git a/src/Driver/Element/Wpcli/WidgetElement.php b/src/Driver/Wpcli/Element/WidgetElement.php similarity index 93% rename from src/Driver/Element/Wpcli/WidgetElement.php rename to src/Driver/Wpcli/Element/WidgetElement.php index 79352213..a307235d 100644 --- a/src/Driver/Element/Wpcli/WidgetElement.php +++ b/src/Driver/Wpcli/Element/WidgetElement.php @@ -1,6 +1,6 @@ drivers->getDriver()->wpcli('widget', 'add', $wpcli_args); + $this->getDriver()->wpcli('widget', 'add', $wpcli_args); } /** diff --git a/src/Driver/WpcliDriver.php b/src/Driver/Wpcli/WpcliDriver.php similarity index 97% rename from src/Driver/WpcliDriver.php rename to src/Driver/Wpcli/WpcliDriver.php index b69998b7..7998a6d1 100644 --- a/src/Driver/WpcliDriver.php +++ b/src/Driver/Wpcli/WpcliDriver.php @@ -1,7 +1,8 @@ [ + 'pipe', + 'w' + ], + 2 => [ + 'pipe', + 'w' + ] + ), $pipes); + + $stdout = trim(stream_get_contents($pipes[1])); + $stderr = trim(stream_get_contents($pipes[2])); + fclose($pipes[1]); + fclose($pipes[2]); + $exit_code = proc_close($proc); + putenv('MYSQL_PWD=' . $old_pwd); + + // Sometimes the error message is in stderr. + if (! $stdout && $stderr) { + $stdout = $stderr; + } + + if ($exit_code || strpos($stdout, 'Warning: ') === 0 || strpos($stdout, 'Error: ') === 0) { + throw new RuntimeException(sprintf("[W606] Could not export database in method %1\$s(): \n\n%2\$s.\n(%3\$s)", debug_backtrace()[1]['function'], $stdout, $exit_code)); + } + + return $path; + } + + /** + * Import site database. + * + * @param int $id + * Not used. + * @param array $args + */ + public function import($id, $args = []) + { + $bin = ''; + $command_args = sprintf('--no-defaults --no-auto-rehash --host=%1$s --user=%2$s --database=%3$s --execute=%4$s', DB_HOST, DB_USER, DB_NAME, escapeshellarg(sprintf('SET autocommit = 0; SET unique_checks = 0; SET foreign_key_checks = 0; SOURCE %1$s; COMMIT;', $args['path']))); + + $old_pwd = getenv('MYSQL_PWD'); + putenv('MYSQL_PWD=' . DB_PASSWORD); + + // Support Windows. + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $bin = '/usr/bin/env '; + } + + // Import DB via mysql-cli. + $proc = proc_open("{$bin}mysql {$command_args}", array( + 1 => [ + 'pipe', + 'w' + ], + 2 => [ + 'pipe', + 'w' + ] + ), $pipes); + + $stdout = trim(stream_get_contents($pipes[1])); + $stderr = trim(stream_get_contents($pipes[2])); + fclose($pipes[1]); + fclose($pipes[2]); + $exit_code = proc_close($proc); + putenv('MYSQL_PWD=' . $old_pwd); + + // Sometimes the error message is in stderr. + if (! $stdout && $stderr) { + $stdout = $stderr; + } + + if ($exit_code || strpos($stdout, 'Warning: ') === 0 || strpos($stdout, 'Error: ') === 0) { + throw new RuntimeException(sprintf("[W607] Could not import database in method %1\$s(): \n\n%2\$s.\n(%3\$s)", debug_backtrace()[1]['function'], $stdout, $exit_code)); + } + + /* + * clear the cache after restoration - this is probably only necessary + * because of some kind of global state issue - the WPCLI driver doensn't + * need it. There is some discussion about it here: + * + * https://github.com/paulgibbs/behat-wordpress-extension/pull/150 + */ + \wp_cache_flush(); + } +} diff --git a/src/Driver/Element/Wpphp/PluginElement.php b/src/Driver/Wpphp/Element/PluginElement.php similarity index 96% rename from src/Driver/Element/Wpphp/PluginElement.php rename to src/Driver/Wpphp/Element/PluginElement.php index 421243a8..ccb226e2 100644 --- a/src/Driver/Element/Wpphp/PluginElement.php +++ b/src/Driver/Wpphp/Element/PluginElement.php @@ -1,6 +1,6 @@ Date: Tue, 3 Apr 2018 17:24:01 +0100 Subject: [PATCH 03/31] Yet more WIP - must tidy up these commit messages --- composer.json | 6 +- composer.lock | 1560 ++++++++++------- phpstan.neon | 2 +- src/Driver/BaseDriver.php | 2 +- src/Driver/Wpcli/Element/DatabaseElement.php | 3 +- src/Driver/Wpcli/Element/UserElement.php | 4 +- src/Driver/Wpcli/Element/WidgetElement.php | 2 +- src/Driver/Wpcli/Element/WpcliBaseElement.php | 20 + .../WordpressBehatExtension.php | 8 +- .../config/drivers/blackbox.yml | 2 +- src/ServiceContainer/config/drivers/wpcli.yml | 2 +- src/ServiceContainer/config/drivers/wpphp.yml | 2 +- 12 files changed, 983 insertions(+), 630 deletions(-) create mode 100644 src/Driver/Wpcli/Element/WpcliBaseElement.php diff --git a/composer.json b/composer.json index 28371d23..83ddbcfb 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,8 @@ "ocramius/proxy-manager": "2.0.4", "zendframework/zend-code": "3.1.0", "behat/mink-extension": "2.3.1", - "ocramius/package-versions": "~1.2.0" + "ocramius/package-versions": "~1.2.0", + "symfony/dependency-injection": "~3.4" }, "require-dev": { "squizlabs/php_codesniffer": "~3.0", @@ -42,7 +43,8 @@ "behat/mink-goutte-driver": "^1.2", "behat/mink-selenium2-driver": "^1.3", "phpstan/phpstan": "~0.9", - "phing/phing": "~2.16" + "phing/phing": "~2.16", + "symfony/symfony": "~3.4" }, "suggest": { "behat/mink-goutte-driver": "Headless Mink driver", diff --git a/composer.lock b/composer.lock index 29e69262..0618a956 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "bf470c06176c9beac773053f6df79f2f", + "content-hash": "fefefd016d1ea0a7f5fa715b2a6e9a69", "packages": [ { "name": "behat/behat", @@ -340,6 +340,463 @@ "homepage": "https://github.com/container-interop/container-interop", "time": "2017-02-14T19:40:03+00:00" }, + { + "name": "doctrine/annotations", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-12-06T07:11:42+00:00" + }, + { + "name": "doctrine/cache", + "version": "v1.7.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/b3217d58609e9c8e661cd41357a54d926c4a2a1a", + "reference": "b3217d58609e9c8e661cd41357a54d926c4a2a1a", + "shasum": "" + }, + "require": { + "php": "~7.1" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "alcaeus/mongo-php-adapter": "^1.1", + "mongodb/mongodb": "^1.1", + "phpunit/phpunit": "^5.7", + "predis/predis": "~1.0" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2017-08-25T07:02:50+00:00" + }, + { + "name": "doctrine/collections", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/a01ee38fcd999f34d9bfbcee59dbda5105449cbf", + "reference": "a01ee38fcd999f34d9bfbcee59dbda5105449cbf", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "~0.1@dev", + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2017-07-22T10:37:32+00:00" + }, + { + "name": "doctrine/common", + "version": "v2.8.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/f68c297ce6455e8fd794aa8ffaf9fa458f6ade66", + "reference": "f68c297ce6455e8fd794aa8ffaf9fa458f6ade66", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~7.1" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2017-08-31T08:43:38+00:00" + }, + { + "name": "doctrine/inflector", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/inflector.git", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a", + "reference": "5527a48b7313d15261292c149e55e26eae771b0a", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^6.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common String Manipulations with regard to casing and singular/plural rules.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "inflection", + "pluralize", + "singularize", + "string" + ], + "time": "2018-01-09T20:05:19+00:00" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "fig/link-util", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/link-util.git", + "reference": "1a07821801a148be4add11ab0603e4af55a72fac" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/link-util/zipball/1a07821801a148be4add11ab0603e4af55a72fac", + "reference": "1a07821801a148be4add11ab0603e4af55a72fac", + "shasum": "" + }, + "require": { + "php": ">=5.5.0", + "psr/link": "~1.0@dev" + }, + "require-dev": { + "phpunit/phpunit": "^5.1", + "squizlabs/php_codesniffer": "^2.3.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Fig\\Link\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common utility implementations for HTTP links", + "keywords": [ + "http", + "http-link", + "link", + "psr", + "psr-13", + "rest" + ], + "time": "2016-10-17T18:31:11+00:00" + }, { "name": "ocramius/package-versions", "version": "1.2.0", @@ -454,6 +911,100 @@ ], "time": "2016-11-04T15:53:15+00:00" }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2017-09-27T21:40:39+00:00" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06T20:24:11+00:00" + }, { "name": "psr/container", "version": "1.0.0", @@ -492,29 +1043,125 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/link", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/link.git", + "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/link/zipball/eea8e8662d5cd3ae4517c9b864493f59fca95562", + "reference": "eea8e8662d5cd3ae4517c9b864493f59fca95562", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Link\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for HTTP links", + "keywords": [ + "http", + "http-link", + "link", + "psr", + "psr-13", + "rest" + ], + "time": "2016-10-28T16:06:13+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "log", + "psr", + "psr-3" ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2016-10-10T12:19:37+00:00" }, { - "name": "psr/log", - "version": "1.0.2", + "name": "psr/simple-cache", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", "shasum": "" }, "require": { @@ -528,7 +1175,7 @@ }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\SimpleCache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -541,14 +1188,15 @@ "homepage": "http://www.php-fig.org/" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Common interfaces for simple caching", "keywords": [ - "log", + "cache", + "caching", "psr", - "psr-3" + "psr-16", + "simple-cache" ], - "time": "2016-10-10T12:19:37+00:00" + "time": "2017-10-23T01:57:42+00:00" }, { "name": "sensiolabs/behat-page-object-extension", @@ -618,41 +1266,34 @@ "time": "2017-05-22T14:16:06+00:00" }, { - "name": "symfony/class-loader", - "version": "v3.4.6", + "name": "symfony/polyfill-apcu", + "version": "v1.7.0", "source": { "type": "git", - "url": "https://github.com/symfony/class-loader.git", - "reference": "e63c12699822bb3b667e7216ba07fbcc3a3e203e" + "url": "https://github.com/symfony/polyfill-apcu.git", + "reference": "e8ae2136ddb53dea314df56fcd88e318ab936c00" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/class-loader/zipball/e63c12699822bb3b667e7216ba07fbcc3a3e203e", - "reference": "e63c12699822bb3b667e7216ba07fbcc3a3e203e", + "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/e8ae2136ddb53dea314df56fcd88e318ab936c00", + "reference": "e8ae2136ddb53dea314df56fcd88e318ab936c00", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" - }, - "require-dev": { - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/polyfill-apcu": "~1.1" - }, - "suggest": { - "symfony/polyfill-apcu": "For using ApcClassLoader on HHVM" + "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "1.7-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\ClassLoader\\": "" + "Symfony\\Polyfill\\Apcu\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -661,179 +1302,55 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony ClassLoader Component", + "description": "Symfony polyfill backporting apcu_* functions to lower PHP versions", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" - }, - { - "name": "symfony/config", - "version": "v3.4.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "05e10567b529476a006b00746c5f538f1636810e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/05e10567b529476a006b00746c5f538f1636810e", - "reference": "05e10567b529476a006b00746c5f538f1636810e", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.3", - "symfony/finder": "<3.3" - }, - "require-dev": { - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/event-dispatcher": "~3.3|~4.0", - "symfony/finder": "~3.3|~4.0", - "symfony/yaml": "~3.0|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } + "keywords": [ + "apcu", + "compatibility", + "polyfill", + "portable", + "shim" ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2018-02-14T10:03:57+00:00" + "time": "2018-01-30T19:27:44+00:00" }, { - "name": "symfony/console", - "version": "v3.4.6", + "name": "symfony/polyfill-intl-icu", + "version": "v1.7.0", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "067339e9b8ec30d5f19f5950208893ff026b94f7" + "url": "https://github.com/symfony/polyfill-intl-icu.git", + "reference": "254919c03761d46c29291616576ed003f10e91c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/067339e9b8ec30d5f19f5950208893ff026b94f7", - "reference": "067339e9b8ec30d5f19f5950208893ff026b94f7", + "url": "https://api.github.com/repos/symfony/polyfill-intl-icu/zipball/254919c03761d46c29291616576ed003f10e91c1", + "reference": "254919c03761d46c29291616576ed003f10e91c1", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0|~4.0", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.3|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.3|~4.0" + "php": ">=5.3.3", + "symfony/intl": "~2.3|~3.0|~4.0" }, "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2018-02-26T15:46:28+00:00" - }, - { - "name": "symfony/css-selector", - "version": "v3.4.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/css-selector.git", - "reference": "544655f1fc078a9cd839fdda2b7b1e64627c826a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/544655f1fc078a9cd839fdda2b7b1e64627c826a", - "reference": "544655f1fc078a9cd839fdda2b7b1e64627c826a", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" + "ext-intl": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "1.7-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\CssSelector\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -842,129 +1359,58 @@ ], "authors": [ { - "name": "Jean-François Simon", - "email": "jeanfrancois.simon@sensiolabs.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony CssSelector Component", + "description": "Symfony polyfill for intl's ICU-related data and classes", "homepage": "https://symfony.com", - "time": "2018-02-03T14:55:07+00:00" - }, - { - "name": "symfony/debug", - "version": "v3.4.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "9b1071f86e79e1999b3d3675d2e0e7684268b9bc" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/9b1071f86e79e1999b3d3675d2e0e7684268b9bc", - "reference": "9b1071f86e79e1999b3d3675d2e0e7684268b9bc", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" - }, - "require-dev": { - "symfony/http-kernel": "~2.8|~3.0|~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Debug\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } + "keywords": [ + "compatibility", + "icu", + "intl", + "polyfill", + "portable", + "shim" ], - "description": "Symfony Debug Component", - "homepage": "https://symfony.com", - "time": "2018-02-28T21:49:22+00:00" + "time": "2018-01-30T19:27:44+00:00" }, { - "name": "symfony/dependency-injection", - "version": "v3.4.6", + "name": "symfony/polyfill-mbstring", + "version": "v1.7.0", "source": { "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "12e901abc1cb0d637a0e5abe9923471361d96b07" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/12e901abc1cb0d637a0e5abe9923471361d96b07", - "reference": "12e901abc1cb0d637a0e5abe9923471361d96b07", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/container": "^1.0" - }, - "conflict": { - "symfony/config": "<3.3.7", - "symfony/finder": "<3.3", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "psr/container-implementation": "1.0" - }, - "require-dev": { - "symfony/config": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/yaml": "~3.4|~4.0" + "php": ">=5.3.3" }, "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" + "ext-mbstring": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "1.7-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" + "Symfony\\Polyfill\\Mbstring\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -973,61 +1419,55 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony DependencyInjection Component", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", - "time": "2018-03-04T03:54:53+00:00" + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-01-30T19:27:44+00:00" }, { - "name": "symfony/event-dispatcher", - "version": "v3.4.6", + "name": "symfony/polyfill-php56", + "version": "v1.7.0", "source": { "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "58990682ac3fdc1f563b7e705452921372aad11d" + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "ebc999ce5f14204c5150b9bd15f8f04e621409d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/58990682ac3fdc1f563b7e705452921372aad11d", - "reference": "58990682ac3fdc1f563b7e705452921372aad11d", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/ebc999ce5f14204c5150b9bd15f8f04e621409d8", + "reference": "ebc999ce5f14204c5150b9bd15f8f04e621409d8", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/dependency-injection": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.3|~4.0", - "symfony/expression-language": "~2.8|~3.0|~4.0", - "symfony/stopwatch": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "1.7-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" + "Symfony\\Polyfill\\Php56\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1036,47 +1476,57 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony EventDispatcher Component", + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", "homepage": "https://symfony.com", - "time": "2018-02-14T10:03:57+00:00" + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-01-30T19:27:44+00:00" }, { - "name": "symfony/filesystem", - "version": "v3.4.6", + "name": "symfony/polyfill-php70", + "version": "v1.7.0", "source": { "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541" + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "3532bfcd8f933a7816f3a0a59682fc404776600f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/253a4490b528597aa14d2bf5aeded6f5e5e4a541", - "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/3532bfcd8f933a7816f3a0a59682fc404776600f", + "reference": "3532bfcd8f933a7816f3a0a59682fc404776600f", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "1.7-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Filesystem\\": "" + "Symfony\\Polyfill\\Php70\\": "" }, - "exclude-from-classmap": [ - "/Tests/" + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1085,38 +1535,41 @@ ], "authors": [ { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Filesystem Component", + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", "homepage": "https://symfony.com", - "time": "2018-02-22T10:48:49+00:00" + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2018-01-30T19:27:44+00:00" }, { - "name": "symfony/polyfill-mbstring", + "name": "symfony/polyfill-util", "version": "v1.7.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b" + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "e17c808ec4228026d4f5a8832afa19be85979563" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/78be803ce01e55d3491c1397cf1c64beb9c1b63b", - "reference": "78be803ce01e55d3491c1397cf1c64beb9c1b63b", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/e17c808ec4228026d4f5a8832afa19be85979563", + "reference": "e17c808ec4228026d4f5a8832afa19be85979563", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "suggest": { - "ext-mbstring": "For best performance" - }, "type": "library", "extra": { "branch-alias": { @@ -1125,11 +1578,8 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Symfony\\Polyfill\\Util\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1145,52 +1595,126 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony utilities for portability of PHP codes", "homepage": "https://symfony.com", "keywords": [ + "compat", "compatibility", - "mbstring", "polyfill", - "portable", "shim" ], - "time": "2018-01-30T19:27:44+00:00" + "time": "2018-01-31T18:08:44+00:00" }, { - "name": "symfony/translation", + "name": "symfony/symfony", "version": "v3.4.6", "source": { "type": "git", - "url": "https://github.com/symfony/translation.git", - "reference": "80e19eaf12cbb546ac40384e5c55c36306823e57" + "url": "https://github.com/symfony/symfony.git", + "reference": "874d4d659774d7bab90538072c83ed532dd17dc5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/80e19eaf12cbb546ac40384e5c55c36306823e57", - "reference": "80e19eaf12cbb546ac40384e5c55c36306823e57", + "url": "https://api.github.com/repos/symfony/symfony/zipball/874d4d659774d7bab90538072c83ed532dd17dc5", + "reference": "874d4d659774d7bab90538072c83ed532dd17dc5", "shasum": "" }, "require": { + "doctrine/common": "~2.4", + "ext-xml": "*", + "fig/link-util": "^1.0", "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0" + "psr/cache": "~1.0", + "psr/container": "^1.0", + "psr/link": "^1.0", + "psr/log": "~1.0", + "psr/simple-cache": "^1.0", + "symfony/polyfill-apcu": "~1.1", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php56": "~1.0", + "symfony/polyfill-php70": "~1.6", + "twig/twig": "^1.35|^2.4.4" }, "conflict": { - "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4", - "symfony/yaml": "<3.4" + "phpdocumentor/reflection-docblock": "<3.0||>=3.2.0,<3.2.2", + "phpdocumentor/type-resolver": "<0.2.1", + "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0" }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/finder": "~2.8|~3.0|~4.0", - "symfony/intl": "^2.8.18|^3.2.5|~4.0", - "symfony/yaml": "~3.4|~4.0" + "provide": { + "psr/cache-implementation": "1.0", + "psr/container-implementation": "1.0", + "psr/log-implementation": "1.0", + "psr/simple-cache-implementation": "1.0" + }, + "replace": { + "symfony/asset": "self.version", + "symfony/browser-kit": "self.version", + "symfony/cache": "self.version", + "symfony/class-loader": "self.version", + "symfony/config": "self.version", + "symfony/console": "self.version", + "symfony/css-selector": "self.version", + "symfony/debug": "self.version", + "symfony/debug-bundle": "self.version", + "symfony/dependency-injection": "self.version", + "symfony/doctrine-bridge": "self.version", + "symfony/dom-crawler": "self.version", + "symfony/dotenv": "self.version", + "symfony/event-dispatcher": "self.version", + "symfony/expression-language": "self.version", + "symfony/filesystem": "self.version", + "symfony/finder": "self.version", + "symfony/form": "self.version", + "symfony/framework-bundle": "self.version", + "symfony/http-foundation": "self.version", + "symfony/http-kernel": "self.version", + "symfony/inflector": "self.version", + "symfony/intl": "self.version", + "symfony/ldap": "self.version", + "symfony/lock": "self.version", + "symfony/monolog-bridge": "self.version", + "symfony/options-resolver": "self.version", + "symfony/process": "self.version", + "symfony/property-access": "self.version", + "symfony/property-info": "self.version", + "symfony/proxy-manager-bridge": "self.version", + "symfony/routing": "self.version", + "symfony/security": "self.version", + "symfony/security-bundle": "self.version", + "symfony/security-core": "self.version", + "symfony/security-csrf": "self.version", + "symfony/security-guard": "self.version", + "symfony/security-http": "self.version", + "symfony/serializer": "self.version", + "symfony/stopwatch": "self.version", + "symfony/templating": "self.version", + "symfony/translation": "self.version", + "symfony/twig-bridge": "self.version", + "symfony/twig-bundle": "self.version", + "symfony/validator": "self.version", + "symfony/var-dumper": "self.version", + "symfony/web-link": "self.version", + "symfony/web-profiler-bundle": "self.version", + "symfony/web-server-bundle": "self.version", + "symfony/workflow": "self.version", + "symfony/yaml": "self.version" }, - "suggest": { - "psr/log": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" + "require-dev": { + "cache/integration-tests": "dev-master", + "doctrine/annotations": "~1.0", + "doctrine/cache": "~1.6", + "doctrine/data-fixtures": "1.0.*", + "doctrine/dbal": "~2.4", + "doctrine/doctrine-bundle": "~1.4", + "doctrine/orm": "~2.4,>=2.4.5", + "egulias/email-validator": "~1.2,>=1.2.8|~2.0", + "monolog/monolog": "~1.11", + "ocramius/proxy-manager": "~0.4|~1.0|~2.0", + "phpdocumentor/reflection-docblock": "^3.0|^4.0", + "predis/predis": "~1.0", + "symfony/phpunit-bridge": "~3.4|~4.0", + "symfony/security-acl": "~2.8|~3.0" }, "type": "library", "extra": { @@ -1200,10 +1724,18 @@ }, "autoload": { "psr-4": { - "Symfony\\Component\\Translation\\": "" + "Symfony\\Bridge\\Doctrine\\": "src/Symfony/Bridge/Doctrine/", + "Symfony\\Bridge\\Monolog\\": "src/Symfony/Bridge/Monolog/", + "Symfony\\Bridge\\ProxyManager\\": "src/Symfony/Bridge/ProxyManager/", + "Symfony\\Bridge\\Twig\\": "src/Symfony/Bridge/Twig/", + "Symfony\\Bundle\\": "src/Symfony/Bundle/", + "Symfony\\Component\\": "src/Symfony/Component/" }, + "classmap": [ + "src/Symfony/Component/Intl/Resources/stubs" + ], "exclude-from-classmap": [ - "/Tests/" + "**/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -1220,67 +1752,78 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Translation Component", + "description": "The Symfony PHP framework", "homepage": "https://symfony.com", - "time": "2018-02-22T06:28:18+00:00" + "keywords": [ + "framework" + ], + "time": "2018-03-05T20:02:01+00:00" }, { - "name": "symfony/yaml", - "version": "v3.4.6", + "name": "twig/twig", + "version": "v2.4.7", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "6af42631dcf89e9c616242c900d6c52bd53bd1bb" + "url": "https://github.com/twigphp/Twig.git", + "reference": "69aacd44dbbaa3199d5afb68605c996d577896fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/6af42631dcf89e9c616242c900d6c52bd53bd1bb", - "reference": "6af42631dcf89e9c616242c900d6c52bd53bd1bb", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/69aacd44dbbaa3199d5afb68605c996d577896fc", + "reference": "69aacd44dbbaa3199d5afb68605c996d577896fc", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" - }, - "conflict": { - "symfony/console": "<3.4" + "php": "^7.0", + "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" + "psr/container": "^1.0", + "symfony/debug": "^2.7", + "symfony/phpunit-bridge": "^3.3" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-master": "2.4-dev" } }, "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" + "psr-0": { + "Twig_": "lib/" }, - "exclude-from-classmap": [ - "/Tests/" - ] + "psr-4": { + "Twig\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "MIT" + "BSD-3-Clause" ], "authors": [ { "name": "Fabien Potencier", - "email": "fabien@symfony.com" + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" }, { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "http://twig.sensiolabs.org/contributors", + "role": "Contributors" } ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2018-02-16T09:50:28+00:00" + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ], + "time": "2018-03-20T04:31:17+00:00" }, { "name": "zendframework/zend-code", @@ -1876,16 +2419,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "6.3.0", + "version": "6.3.2", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699" + "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/f4db5a78a5ea468d4831de7f0bf9d9415e348699", - "reference": "f4db5a78a5ea468d4831de7f0bf9d9415e348699", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/68d0ea14d5a3f42a20e87632a5f84931e2709c90", + "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90", "shasum": "" }, "require": { @@ -1895,7 +2438,7 @@ }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0 || ^5.0", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4", "psr/log": "^1.0" }, "suggest": { @@ -1904,7 +2447,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.2-dev" + "dev-master": "6.3-dev" } }, "autoload": { @@ -1937,7 +2480,7 @@ "rest", "web service" ], - "time": "2017-06-22T18:50:49+00:00" + "time": "2018-03-26T16:33:04+00:00" }, { "name": "guzzlehttp/promises", @@ -2198,7 +2741,7 @@ "email": "sven.eisenschmidt@gmail.com" }, { - "name": "Javier Gomez", + "name": "Javier Gómez", "email": "javier.gomez@community.joomla.org" } ], @@ -3415,217 +3958,6 @@ ], "time": "2018-02-20T21:35:23+00:00" }, - { - "name": "symfony/browser-kit", - "version": "v3.4.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/browser-kit.git", - "reference": "490f27762705c8489bd042fe3e9377a191dba9b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/browser-kit/zipball/490f27762705c8489bd042fe3e9377a191dba9b4", - "reference": "490f27762705c8489bd042fe3e9377a191dba9b4", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/dom-crawler": "~2.8|~3.0|~4.0" - }, - "require-dev": { - "symfony/css-selector": "~2.8|~3.0|~4.0", - "symfony/process": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\BrowserKit\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony BrowserKit Component", - "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" - }, - { - "name": "symfony/dom-crawler", - "version": "v3.4.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/dom-crawler.git", - "reference": "2bb5d3101cc01f4fe580e536daf4f1959bc2d24d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2bb5d3101cc01f4fe580e536daf4f1959bc2d24d", - "reference": "2bb5d3101cc01f4fe580e536daf4f1959bc2d24d", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/polyfill-mbstring": "~1.0" - }, - "require-dev": { - "symfony/css-selector": "~2.8|~3.0|~4.0" - }, - "suggest": { - "symfony/css-selector": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DomCrawler\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DomCrawler Component", - "homepage": "https://symfony.com", - "time": "2018-02-22T10:48:49+00:00" - }, - { - "name": "symfony/finder", - "version": "v3.4.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "a479817ce0a9e4adfd7d39c6407c95d97c254625" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/a479817ce0a9e4adfd7d39c6407c95d97c254625", - "reference": "a479817ce0a9e4adfd7d39c6407c95d97c254625", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2018-03-05T18:28:11+00:00" - }, - { - "name": "symfony/process", - "version": "v3.4.6", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "cc4aea21f619116aaf1c58016a944e4821c8e8af" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/cc4aea21f619116aaf1c58016a944e4821c8e8af", - "reference": "cc4aea21f619116aaf1c58016a944e4821c8e8af", - "shasum": "" - }, - "require": { - "php": "^5.5.9|>=7.0.8" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2018-02-12T17:55:00+00:00" - }, { "name": "wp-cli/autoload-splitter", "version": "v0.1.5", diff --git a/phpstan.neon b/phpstan.neon index c95d4469..d3c2acf8 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -2,4 +2,4 @@ parameters: excludes_analyse: # These reference global WP functions. - %rootDir%/../../../src/Driver/Wpphp/Element/* - - src/Driver/WpphpDriver.php + - src/Driver/Wpphp/WpphpDriver.php diff --git a/src/Driver/BaseDriver.php b/src/Driver/BaseDriver.php index e770f8dc..ec4547da 100644 --- a/src/Driver/BaseDriver.php +++ b/src/Driver/BaseDriver.php @@ -34,7 +34,7 @@ abstract class BaseDriver implements DriverInterface * @var \PaulGibbs\WordpressBehatExtension\Driver\Element\ElementInterface[] */ protected $elements = []; - + /** * Expose $elements as public properties. * diff --git a/src/Driver/Wpcli/Element/DatabaseElement.php b/src/Driver/Wpcli/Element/DatabaseElement.php index de3f499e..6baba56d 100644 --- a/src/Driver/Wpcli/Element/DatabaseElement.php +++ b/src/Driver/Wpcli/Element/DatabaseElement.php @@ -2,13 +2,12 @@ declare(strict_types=1); namespace PaulGibbs\WordpressBehatExtension\Driver\Wpcli\Element; -use PaulGibbs\WordpressBehatExtension\Driver\Element\DatabaseElementInterface; use RuntimeException; /** * WP-CLI driver element for manipulating the database directly. */ -class DatabaseElement implements DatabaseElementInterface +class DatabaseElement extends WpcliBaseElement { /** diff --git a/src/Driver/Wpcli/Element/UserElement.php b/src/Driver/Wpcli/Element/UserElement.php index ee487240..475e6163 100644 --- a/src/Driver/Wpcli/Element/UserElement.php +++ b/src/Driver/Wpcli/Element/UserElement.php @@ -31,7 +31,7 @@ public function create($args) ); array_unshift($wpcli_args, $args['user_login'], $args['user_email'], '--porcelain'); - $user_id = (int) $this->drivers->getDriver()->wpcli('user', 'create', $wpcli_args)['stdout']; + $user_id = (int) $this->getDriver()->wpcli('user', 'create', $wpcli_args)['stdout']; return $this->get($user_id); } @@ -78,7 +78,7 @@ public function get($id, $args = []) ); array_unshift($wpcli_args, $id, '--format=json'); - $user = $this->drivers->getDriver()->wpcli('user', 'get', $wpcli_args)['stdout']; + $user = $this->getDriver()->wpcli('user', 'get', $wpcli_args)['stdout']; $user = json_decode($user); if (! $user) { diff --git a/src/Driver/Wpcli/Element/WidgetElement.php b/src/Driver/Wpcli/Element/WidgetElement.php index a307235d..b3741955 100644 --- a/src/Driver/Wpcli/Element/WidgetElement.php +++ b/src/Driver/Wpcli/Element/WidgetElement.php @@ -42,7 +42,7 @@ public function addToSidebar($widget_name, $sidebar_id, $args) */ public function getSidebar($sidebar_name) { - $registered_sidebars = json_decode($this->drivers->getDriver()->wpcli('sidebar', 'list', [ + $registered_sidebars = json_decode($this->getDriver()->wpcli('sidebar', 'list', [ '--format=json', ])['stdout']); diff --git a/src/Driver/Wpcli/Element/WpcliBaseElement.php b/src/Driver/Wpcli/Element/WpcliBaseElement.php new file mode 100644 index 00000000..68868ce6 --- /dev/null +++ b/src/Driver/Wpcli/Element/WpcliBaseElement.php @@ -0,0 +1,20 @@ +load('drivers/wpcli.yml'); $config['wpcli']['alias'] = isset($config['wpcli']['alias']) ? $config['wpcli']['alias'] : ''; - $container->setParameter('wordpress.driver.wpcli.alias', $config['wpcli']['alias']); + $container->setParameter('wordpress.driver.alias', $config['wpcli']['alias']); $config['wpcli']['path'] = isset($config['path']) ? $config['path'] : ''; - $container->setParameter('wordpress.driver.wpcli.path', $config['path']); + $container->setParameter('wordpress.driver.path', $config['path']); $config['wpcli']['binary'] = isset($config['wpcli']['binary']) ? $config['wpcli']['binary'] : null; - $container->setParameter('wordpress.driver.wpcli.binary', $config['wpcli']['binary']); + $container->setParameter('wordpress.driver.binary', $config['wpcli']['binary']); } /** @@ -274,7 +274,7 @@ protected function setupWpphpDriver(FileLoader $loader, ContainerBuilder $contai $loader->load('drivers/wpphp.yml'); $config['wpphp']['path'] = isset($config['path']) ? $config['path'] : ''; - $container->setParameter('wordpress.driver.wpphp.path', $config['wpphp']['path']); + $container->setParameter('wordpress.driver.path', $config['wpphp']['path']); } /** diff --git a/src/ServiceContainer/config/drivers/blackbox.yml b/src/ServiceContainer/config/drivers/blackbox.yml index 556c1588..ff8b77f0 100755 --- a/src/ServiceContainer/config/drivers/blackbox.yml +++ b/src/ServiceContainer/config/drivers/blackbox.yml @@ -1,5 +1,5 @@ parameters: - wordpress.driver.blackbox.class: PaulGibbs\WordpressBehatExtension\Driver\BlackboxDriver + wordpress.driver.blackbox.class: PaulGibbs\WordpressBehatExtension\Driver\Blackbox\BlackboxDriver services: wordpress.driver.blackbox: diff --git a/src/ServiceContainer/config/drivers/wpcli.yml b/src/ServiceContainer/config/drivers/wpcli.yml index 9f9ce0a9..a3ce68ff 100755 --- a/src/ServiceContainer/config/drivers/wpcli.yml +++ b/src/ServiceContainer/config/drivers/wpcli.yml @@ -11,7 +11,7 @@ parameters: wordpress.element.widget.class: PaulGibbs\WordpressBehatExtension\Driver\Wpcli\Element\WidgetElement services: - wordpress.driver.wpcli: + wordpress.driver: class: "%wordpress.driver.class%" arguments: - "%wordpress.driver.alias%" diff --git a/src/ServiceContainer/config/drivers/wpphp.yml b/src/ServiceContainer/config/drivers/wpphp.yml index c7c689dd..15efeb4b 100755 --- a/src/ServiceContainer/config/drivers/wpphp.yml +++ b/src/ServiceContainer/config/drivers/wpphp.yml @@ -17,7 +17,7 @@ services: public: false wordpress.driver: - class: "%wordpress.driver.wpphp.class%" + class: "%wordpress.driver.class%" arguments: - "%wordpress.path%" tags: From bda9be3c039dca8024a43d2061306c522dded486 Mon Sep 17 00:00:00 2001 From: Richard Vodden Date: Sat, 21 Apr 2018 18:15:20 +0100 Subject: [PATCH 04/31] Converted drivers to use constructor injection --- build.xml | 14 +- build/phing/behat.xml | 3 +- build/phing/docker.xml | 3 +- composer.lock | 165 +++---- phpcs-ruleset.xml | 1 + src/Compiler/DriverElementPass.php | 21 +- src/Compiler/DriverPass.php | 50 ++- .../CommentAwareContextInterface.php | 17 + .../DatabaseAwareContextInterface.php | 6 + .../PluginAwareContextInterface.php | 17 + src/Context/SiteContext.php | 11 +- .../Traits/CommentAwareContextTrait.php | 13 +- .../Traits/PluginAwareContextTrait.php | 16 +- .../{BaseDriver.php => BaseManager.php} | 8 +- src/Driver/BlackBox/BlackboxDriver.php | 3 +- src/Driver/DriverInterface.php | 27 -- src/Driver/DriverManagerInterface.php | 47 ++ src/Driver/Element/BaseElement.php | 23 - src/Driver/Element/BasePluginElement.php | 14 + .../Interfaces/CommentElementInterface.php | 35 ++ .../DatabaseElementInterface.php | 5 +- .../Element/Interfaces/ElementInterface.php | 17 + .../Interfaces/PluginElementInterface.php | 22 + src/Driver/Wpcli/Element/CacheElement.php | 3 +- src/Driver/Wpcli/Element/CommentElement.php | 6 +- src/Driver/Wpcli/Element/PluginElement.php | 4 +- src/Driver/Wpcli/Element/WpcliBaseElement.php | 13 +- src/Driver/Wpcli/WpcliDriver.php | 90 +--- src/Driver/Wpcli/WpcliDriverInterface.php | 7 + src/Driver/Wpcli/WpcliManager.php | 69 +++ src/Driver/Wpphp/Element/DatabaseElement.php | 32 +- src/Driver/Wpphp/Element/PluginElement.php | 3 +- src/Driver/Wpphp/WpphpDriver.php | 18 +- src/PageObject/Element/AdminMenu.php | 1 - .../WordpressBehatExtension.php | 407 ++++++++++-------- .../config/drivers/blackbox.yml | 8 - src/ServiceContainer/config/drivers/wpcli.yml | 85 ---- src/ServiceContainer/config/drivers/wpphp.yml | 87 ---- src/ServiceContainer/config/services.yml | 26 +- src/WordpressDriverManager.php | 13 +- 40 files changed, 729 insertions(+), 681 deletions(-) create mode 100644 src/Context/Interfaces/CommentAwareContextInterface.php create mode 100644 src/Context/Interfaces/DatabaseAwareContextInterface.php create mode 100644 src/Context/Interfaces/PluginAwareContextInterface.php rename src/Driver/{BaseDriver.php => BaseManager.php} (88%) delete mode 100644 src/Driver/DriverInterface.php create mode 100644 src/Driver/DriverManagerInterface.php create mode 100644 src/Driver/Element/BasePluginElement.php create mode 100644 src/Driver/Element/Interfaces/CommentElementInterface.php rename src/Driver/Element/{ => Interfaces}/DatabaseElementInterface.php (86%) create mode 100644 src/Driver/Element/Interfaces/ElementInterface.php create mode 100644 src/Driver/Element/Interfaces/PluginElementInterface.php create mode 100644 src/Driver/Wpcli/WpcliDriverInterface.php create mode 100644 src/Driver/Wpcli/WpcliManager.php delete mode 100755 src/ServiceContainer/config/drivers/blackbox.yml delete mode 100755 src/ServiceContainer/config/drivers/wpcli.yml delete mode 100755 src/ServiceContainer/config/drivers/wpphp.yml diff --git a/build.xml b/build.xml index 55fac7d8..4f2f6521 100644 --- a/build.xml +++ b/build.xml @@ -1,10 +1,10 @@ + - + @@ -76,8 +76,7 @@ -