Version Description
- 2021-11-04 =
- Changed plugin deactivation modal
Download this release
Release Info
Developer | wpdesk |
Plugin | Flexible Checkout Fields for WooCommerce – WooCommerce Checkout Manager |
Version | 3.1.1 |
Comparing to | |
See all releases |
Code changes from version 3.1.0 to 3.1.1
- flexible-checkout-fields.php +5 -5
- lang/flexible-checkout-fields.pot +62 -2
- readme.txt +4 -1
- src/Plugin.php +7 -4
- src/Tracker/DeactivationTracker.php +160 -7
- vendor/autoload.php +1 -1
- vendor/composer/autoload_classmap.php +7 -0
- vendor/composer/autoload_real.php +4 -4
- vendor/composer/autoload_static.php +11 -4
- vendor_prefixed/wpdesk/wp-codeception/composer.json +8 -3
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php +5 -1
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/Configuration.php +360 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/LocalCodeceptionTrait.php +213 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareCodeceptionDb.php +43 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareLocalCodeceptionTests.php +60 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareParallelCodeceptionTests.php +57 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareWordpressForCodeception.php +66 -0
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php +11 -3
- vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SettingsException.php +14 -0
- vendor_prefixed/wpdesk/wp-notice/composer.json +1 -1
flexible-checkout-fields.php
CHANGED
@@ -3,15 +3,15 @@
|
|
3 |
Plugin Name: Flexible Checkout Fields
|
4 |
Plugin URI: https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/
|
5 |
Description: Manage your WooCommerce checkout fields. Change order, labels, placeholders and add new fields.
|
6 |
-
Version: 3.1.
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-checkout-fields
|
10 |
Domain Path: /lang/
|
11 |
Requires at least: 5.2
|
12 |
-
Tested up to: 5.
|
13 |
-
WC requires at least: 5.
|
14 |
-
WC tested up to: 5.
|
15 |
Requires PHP: 7.0
|
16 |
|
17 |
Copyright 2017 WP Desk Ltd.
|
@@ -39,7 +39,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|
39 |
|
40 |
|
41 |
/* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
|
42 |
-
$plugin_version = '3.1.
|
43 |
|
44 |
/*
|
45 |
* Update when conditions are met:
|
3 |
Plugin Name: Flexible Checkout Fields
|
4 |
Plugin URI: https://www.wpdesk.net/products/flexible-checkout-fields-pro-woocommerce/
|
5 |
Description: Manage your WooCommerce checkout fields. Change order, labels, placeholders and add new fields.
|
6 |
+
Version: 3.1.1
|
7 |
Author: WP Desk
|
8 |
Author URI: https://www.wpdesk.net/
|
9 |
Text Domain: flexible-checkout-fields
|
10 |
Domain Path: /lang/
|
11 |
Requires at least: 5.2
|
12 |
+
Tested up to: 5.8
|
13 |
+
WC requires at least: 5.5
|
14 |
+
WC tested up to: 5.9
|
15 |
Requires PHP: 7.0
|
16 |
|
17 |
Copyright 2017 WP Desk Ltd.
|
39 |
|
40 |
|
41 |
/* THIS VARIABLE CAN BE CHANGED AUTOMATICALLY */
|
42 |
+
$plugin_version = '3.1.1';
|
43 |
|
44 |
/*
|
45 |
* Update when conditions are met:
|
lang/flexible-checkout-fields.pot
CHANGED
@@ -2,14 +2,14 @@
|
|
2 |
# This file is distributed under the same license as the Flexible Checkout Fields plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Flexible Checkout Fields 3.1.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/flexible-checkout-fields\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
-
"POT-Creation-Date: 2021-
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: flexible-checkout-fields\n"
|
@@ -482,6 +482,66 @@ msgstr ""
|
|
482 |
msgid "Pricing"
|
483 |
msgstr ""
|
484 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
485 |
#: templates/notices/review.php:16
|
486 |
msgid "Thanks for using the free version of Flexible Checkout Fields!"
|
487 |
msgstr ""
|
2 |
# This file is distributed under the same license as the Flexible Checkout Fields plugin.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Flexible Checkout Fields 3.1.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/flexible-checkout-fields\n"
|
7 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
8 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"POT-Creation-Date: 2021-11-04T21:35:19+00:00\n"
|
13 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
14 |
"X-Generator: WP-CLI 2.4.0\n"
|
15 |
"X-Domain: flexible-checkout-fields\n"
|
482 |
msgid "Pricing"
|
483 |
msgstr ""
|
484 |
|
485 |
+
#: src/Tracker/DeactivationTracker.php:51
|
486 |
+
msgid "The plugin does not work properly"
|
487 |
+
msgstr ""
|
488 |
+
|
489 |
+
#: src/Tracker/DeactivationTracker.php:53
|
490 |
+
msgid "Contact us on %1$sthe support forum%2$s or read %3$sthe plugin FAQ%4$s for help."
|
491 |
+
msgstr ""
|
492 |
+
|
493 |
+
#: src/Tracker/DeactivationTracker.php:59
|
494 |
+
msgid "Please tell us what was the problem."
|
495 |
+
msgstr ""
|
496 |
+
|
497 |
+
#: src/Tracker/DeactivationTracker.php:66
|
498 |
+
msgid "The plugin is difficult to use"
|
499 |
+
msgstr ""
|
500 |
+
|
501 |
+
#: src/Tracker/DeactivationTracker.php:68
|
502 |
+
msgid "Check %1$sthe documentation%2$s or contact us on %3$sthe support forum%4$s for help."
|
503 |
+
msgstr ""
|
504 |
+
|
505 |
+
#: src/Tracker/DeactivationTracker.php:74
|
506 |
+
msgid "How can we do it better? Please write what was problematic."
|
507 |
+
msgstr ""
|
508 |
+
|
509 |
+
#: src/Tracker/DeactivationTracker.php:81
|
510 |
+
msgid "The plugin does not meet all the requirements"
|
511 |
+
msgstr ""
|
512 |
+
|
513 |
+
#: src/Tracker/DeactivationTracker.php:83
|
514 |
+
msgid "Please write what function is missing."
|
515 |
+
msgstr ""
|
516 |
+
|
517 |
+
#: src/Tracker/DeactivationTracker.php:90
|
518 |
+
msgid "I found a better plugin"
|
519 |
+
msgstr ""
|
520 |
+
|
521 |
+
#: src/Tracker/DeactivationTracker.php:92
|
522 |
+
msgid "Please write what plugin is it and what was the reason for choosing it."
|
523 |
+
msgstr ""
|
524 |
+
|
525 |
+
#: src/Tracker/DeactivationTracker.php:99
|
526 |
+
msgid "The plugin is no longer needed"
|
527 |
+
msgstr ""
|
528 |
+
|
529 |
+
#: src/Tracker/DeactivationTracker.php:101
|
530 |
+
msgid "What is the reason for that?"
|
531 |
+
msgstr ""
|
532 |
+
|
533 |
+
#: src/Tracker/DeactivationTracker.php:108
|
534 |
+
msgid "It's a temporary deactivation (I'm just debugging an issue)"
|
535 |
+
msgstr ""
|
536 |
+
|
537 |
+
#: src/Tracker/DeactivationTracker.php:115
|
538 |
+
msgid "Other"
|
539 |
+
msgstr ""
|
540 |
+
|
541 |
+
#: src/Tracker/DeactivationTracker.php:117
|
542 |
+
msgid "Please tell us what made you click this option."
|
543 |
+
msgstr ""
|
544 |
+
|
545 |
#: templates/notices/review.php:16
|
546 |
msgid "Thanks for using the free version of Flexible Checkout Fields!"
|
547 |
msgstr ""
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: wpdesk,dyszczo,grola,piotrpo,marcinkolanko,mateuszgbiorczyk,sebast
|
|
4 |
Donate link: https://www.wpdesk.net/flexible-checkout-fields-woocommerce/
|
5 |
Tags: woocommerce checkout fields, woocommerce custom fields, woocommerce checkout manager, woocommerce checkout editor, woocommerce fields manager
|
6 |
Requires at least: 4.9
|
7 |
-
Tested up to: 5.
|
8 |
Stable tag: trunk
|
9 |
Requires PHP: 7.0
|
10 |
License: GPLv3 or later
|
@@ -190,6 +190,9 @@ If you are upgrading from the old WooCommerce Checkout Fields version (1.1, wooc
|
|
190 |
|
191 |
== Changelog ==
|
192 |
|
|
|
|
|
|
|
193 |
= 3.1.0 - 2021-09-09 =
|
194 |
* Removed duplicate contact details in order edit in administration panel
|
195 |
* Fixed validation of field value in plugin settings
|
4 |
Donate link: https://www.wpdesk.net/flexible-checkout-fields-woocommerce/
|
5 |
Tags: woocommerce checkout fields, woocommerce custom fields, woocommerce checkout manager, woocommerce checkout editor, woocommerce fields manager
|
6 |
Requires at least: 4.9
|
7 |
+
Tested up to: 5.8
|
8 |
Stable tag: trunk
|
9 |
Requires PHP: 7.0
|
10 |
License: GPLv3 or later
|
190 |
|
191 |
== Changelog ==
|
192 |
|
193 |
+
= 3.1.1 - 2021-11-04 =
|
194 |
+
* Changed plugin deactivation modal
|
195 |
+
|
196 |
= 3.1.0 - 2021-09-09 =
|
197 |
* Removed duplicate contact details in order edit in administration panel
|
198 |
* Fixed validation of field value in plugin settings
|
src/Plugin.php
CHANGED
@@ -58,15 +58,18 @@ class Plugin extends AbstractPlugin implements HookableCollection {
|
|
58 |
* @return void
|
59 |
*/
|
60 |
public function init() {
|
61 |
-
$this->add_hookable( new Admin\NoticeReview() );
|
62 |
-
( new Field\Types() )->init();
|
63 |
$this->add_hookable( new Helpers\Shortener() );
|
64 |
-
|
|
|
65 |
$this->add_hookable( new Settings\Page() );
|
|
|
|
|
|
|
|
|
|
|
66 |
( new Settings\Forms() )->init();
|
67 |
( new Settings\Routes() )->init();
|
68 |
( new Settings\Tabs() )->init();
|
69 |
-
( new Tracker\DeactivationTracker( $this->plugin_info ) )->init();
|
70 |
}
|
71 |
|
72 |
/**
|
58 |
* @return void
|
59 |
*/
|
60 |
public function init() {
|
|
|
|
|
61 |
$this->add_hookable( new Helpers\Shortener() );
|
62 |
+
|
63 |
+
$this->add_hookable( new Admin\NoticeReview() );
|
64 |
$this->add_hookable( new Settings\Page() );
|
65 |
+
|
66 |
+
$this->add_hookable( new Integration\IntegratorIntegration( $this->plugin_old ) );
|
67 |
+
$this->add_hookable( new Tracker\DeactivationTracker( $this->plugin_info ) );
|
68 |
+
|
69 |
+
( new Field\Types() )->init();
|
70 |
( new Settings\Forms() )->init();
|
71 |
( new Settings\Routes() )->init();
|
72 |
( new Settings\Tabs() )->init();
|
|
|
73 |
}
|
74 |
|
75 |
/**
|
src/Tracker/DeactivationTracker.php
CHANGED
@@ -3,14 +3,18 @@
|
|
3 |
namespace WPDesk\FCF\Free\Tracker;
|
4 |
|
5 |
use FcfVendor\WPDesk\DeactivationModal;
|
|
|
6 |
use FcfVendor\WPDesk_Plugin_Info;
|
|
|
|
|
7 |
|
8 |
/**
|
9 |
* Handles the modal displayed when the plugin is deactivated.
|
10 |
*/
|
11 |
-
class DeactivationTracker {
|
12 |
|
13 |
-
const PLUGIN_SLUG
|
|
|
14 |
|
15 |
/**
|
16 |
* @var WPDesk_Plugin_Info
|
@@ -25,20 +29,169 @@ class DeactivationTracker {
|
|
25 |
}
|
26 |
|
27 |
/**
|
28 |
-
*
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
30 |
* @return void
|
|
|
31 |
*/
|
32 |
-
public function
|
33 |
new DeactivationModal\Modal(
|
34 |
self::PLUGIN_SLUG,
|
35 |
( new DeactivationModal\Model\FormTemplate( $this->plugin_info->get_plugin_name() ) ),
|
36 |
-
( new DeactivationModal\Model\
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
new DeactivationModal\Sender\DataWpdeskSender(
|
39 |
$this->plugin_info->get_plugin_file_name(),
|
40 |
$this->plugin_info->get_plugin_name()
|
41 |
)
|
42 |
);
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
}
|
3 |
namespace WPDesk\FCF\Free\Tracker;
|
4 |
|
5 |
use FcfVendor\WPDesk\DeactivationModal;
|
6 |
+
use FcfVendor\WPDesk\PluginBuilder\Plugin\Hookable;
|
7 |
use FcfVendor\WPDesk_Plugin_Info;
|
8 |
+
use WPDesk\FCF\Free\Settings\Form\EditFieldsForm;
|
9 |
+
use WPDesk\FCF\Free\Settings\Option\CustomFieldOption;
|
10 |
|
11 |
/**
|
12 |
* Handles the modal displayed when the plugin is deactivated.
|
13 |
*/
|
14 |
+
class DeactivationTracker implements Hookable {
|
15 |
|
16 |
+
const PLUGIN_SLUG = 'flexible-checkout-fields';
|
17 |
+
const ACTIVATION_OPTION_NAME = 'plugin_activation_%s';
|
18 |
|
19 |
/**
|
20 |
* @var WPDesk_Plugin_Info
|
29 |
}
|
30 |
|
31 |
/**
|
32 |
+
* {@inheritdoc}
|
33 |
+
*/
|
34 |
+
public function hooks() {
|
35 |
+
add_action( 'plugins_loaded', [ $this, 'load_deactivation_modal' ] );
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
* @return void
|
40 |
+
* @internal
|
41 |
*/
|
42 |
+
public function load_deactivation_modal() {
|
43 |
new DeactivationModal\Modal(
|
44 |
self::PLUGIN_SLUG,
|
45 |
( new DeactivationModal\Model\FormTemplate( $this->plugin_info->get_plugin_name() ) ),
|
46 |
+
( new DeactivationModal\Model\FormOptions() )
|
47 |
+
->set_option(
|
48 |
+
new DeactivationModal\Model\FormOption(
|
49 |
+
'plugin_not_working',
|
50 |
+
10,
|
51 |
+
__( 'The plugin does not work properly', 'flexible-checkout-fields' ),
|
52 |
+
sprintf(
|
53 |
+
__( 'Contact us on %1$sthe support forum%2$s or read %3$sthe plugin FAQ%4$s for help.', 'flexible-checkout-fields' ),
|
54 |
+
'<a href="' . esc_url( apply_filters( 'flexible_checkout_fields/short_url', '#', 'fcf-doesnt-work-properly-support-forum' ) ) . '" target="_blank">',
|
55 |
+
'</a>',
|
56 |
+
'<a href="' . esc_url( apply_filters( 'flexible_checkout_fields/short_url', '#', 'fcf-doesnt-work-properly-faq' ) ) . '" target="_blank">',
|
57 |
+
'</a>'
|
58 |
+
),
|
59 |
+
__( 'Please tell us what was the problem.', 'flexible-checkout-fields' )
|
60 |
+
)
|
61 |
+
)
|
62 |
+
->set_option(
|
63 |
+
new DeactivationModal\Model\FormOption(
|
64 |
+
'difficult_to_use',
|
65 |
+
20,
|
66 |
+
__( 'The plugin is difficult to use', 'flexible-checkout-fields' ),
|
67 |
+
sprintf(
|
68 |
+
__( 'Check %1$sthe documentation%2$s or contact us on %3$sthe support forum%4$s for help.', 'flexible-checkout-fields' ),
|
69 |
+
'<a href="' . esc_url( apply_filters( 'flexible_checkout_fields/short_url', '#', 'fcf-plugin-is-difficult-docs' ) ) . '" target="_blank">',
|
70 |
+
'</a>',
|
71 |
+
'<a href="' . esc_url( apply_filters( 'flexible_checkout_fields/short_url', '#', 'fcf-plugin-is-difficult-support-forum' ) ) . '" target="_blank">',
|
72 |
+
'</a>'
|
73 |
+
),
|
74 |
+
__( 'How can we do it better? Please write what was problematic.', 'flexible-checkout-fields' )
|
75 |
+
)
|
76 |
+
)
|
77 |
+
->set_option(
|
78 |
+
new DeactivationModal\Model\FormOption(
|
79 |
+
'not_meet_requirements',
|
80 |
+
30,
|
81 |
+
__( 'The plugin does not meet all the requirements', 'flexible-checkout-fields' ),
|
82 |
+
null,
|
83 |
+
__( 'Please write what function is missing.', 'flexible-checkout-fields' )
|
84 |
+
)
|
85 |
+
)
|
86 |
+
->set_option(
|
87 |
+
new DeactivationModal\Model\FormOption(
|
88 |
+
'found_better_plugin',
|
89 |
+
40,
|
90 |
+
__( 'I found a better plugin', 'flexible-checkout-fields' ),
|
91 |
+
null,
|
92 |
+
__( 'Please write what plugin is it and what was the reason for choosing it.', 'flexible-checkout-fields' )
|
93 |
+
)
|
94 |
+
)
|
95 |
+
->set_option(
|
96 |
+
new DeactivationModal\Model\FormOption(
|
97 |
+
'no_longer_need',
|
98 |
+
50,
|
99 |
+
__( 'The plugin is no longer needed', 'flexible-checkout-fields' ),
|
100 |
+
null,
|
101 |
+
__( 'What is the reason for that?', 'flexible-checkout-fields' )
|
102 |
+
)
|
103 |
+
)
|
104 |
+
->set_option(
|
105 |
+
new DeactivationModal\Model\FormOption(
|
106 |
+
'temporary_deactivation',
|
107 |
+
60,
|
108 |
+
__( 'It\'s a temporary deactivation (I\'m just debugging an issue)', 'flexible-checkout-fields' )
|
109 |
+
)
|
110 |
+
)
|
111 |
+
->set_option(
|
112 |
+
new DeactivationModal\Model\FormOption(
|
113 |
+
'other',
|
114 |
+
70,
|
115 |
+
__( 'Other', 'flexible-checkout-fields' ),
|
116 |
+
null,
|
117 |
+
__( 'Please tell us what made you click this option.', 'flexible-checkout-fields' )
|
118 |
+
)
|
119 |
+
),
|
120 |
+
( new DeactivationModal\Model\FormValues() )
|
121 |
+
->set_value(
|
122 |
+
new DeactivationModal\Model\FormValue(
|
123 |
+
'is_localhost',
|
124 |
+
[ $this, 'is_localhost' ]
|
125 |
+
)
|
126 |
+
)
|
127 |
+
->set_value(
|
128 |
+
new DeactivationModal\Model\FormValue(
|
129 |
+
'plugin_using_time',
|
130 |
+
[ $this, 'get_time_of_plugin_using' ]
|
131 |
+
)
|
132 |
+
)
|
133 |
+
->set_value(
|
134 |
+
new DeactivationModal\Model\FormValue(
|
135 |
+
'settings_saved',
|
136 |
+
[ $this, 'check_if_plugin_settings_saved' ]
|
137 |
+
)
|
138 |
+
)
|
139 |
+
->set_value(
|
140 |
+
new DeactivationModal\Model\FormValue(
|
141 |
+
'custom_fields_added',
|
142 |
+
[ $this, 'check_if_custom_field_created' ]
|
143 |
+
)
|
144 |
+
),
|
145 |
new DeactivationModal\Sender\DataWpdeskSender(
|
146 |
$this->plugin_info->get_plugin_file_name(),
|
147 |
$this->plugin_info->get_plugin_name()
|
148 |
)
|
149 |
);
|
150 |
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
* @internal
|
154 |
+
*/
|
155 |
+
public function is_localhost(): bool {
|
156 |
+
return ( in_array( $_SERVER['REMOTE_ADDR'] ?? '', [ '127.0.0.1', '::1' ] ) );
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* @return string|null
|
161 |
+
* @internal
|
162 |
+
*/
|
163 |
+
public function get_time_of_plugin_using() {
|
164 |
+
$option_activation = sprintf( self::ACTIVATION_OPTION_NAME, $this->plugin_info->get_plugin_file_name() );
|
165 |
+
$activation_date = get_option( $option_activation, null );
|
166 |
+
if ( $activation_date === null ) {
|
167 |
+
return null;
|
168 |
+
}
|
169 |
+
|
170 |
+
|
171 |
+
$current_date = current_time( 'mysql' );
|
172 |
+
return ( strtotime( $current_date ) - strtotime( $activation_date ) );
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* @internal
|
177 |
+
*/
|
178 |
+
public function check_if_plugin_settings_saved(): bool {
|
179 |
+
$settings = get_option( EditFieldsForm::SETTINGS_OPTION_NAME, null );
|
180 |
+
return ( $settings !== null );
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* @internal
|
185 |
+
*/
|
186 |
+
public function check_if_custom_field_created(): bool {
|
187 |
+
$settings = get_option( EditFieldsForm::SETTINGS_OPTION_NAME, [] );
|
188 |
+
foreach ( $settings as $section_fields ) {
|
189 |
+
foreach ( $section_fields as $section_field ) {
|
190 |
+
if ( $section_field[ CustomFieldOption::FIELD_NAME ] ?? false ) {
|
191 |
+
return true;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
}
|
195 |
+
return false;
|
196 |
+
}
|
197 |
}
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit0118c512262255eaa7e1fe5b40839be0::getLoader();
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -109,10 +109,17 @@ return array(
|
|
109 |
'FcfVendor\\WPDesk\\Codeception\\Command\\WooCommerceTestGenerator' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/WooCommerceTestGenerator.php',
|
110 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\CommandProvider' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php',
|
111 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\BaseCommand' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/BaseCommand.php',
|
|
|
112 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\CreateCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/CreateCodeceptionTests.php',
|
|
|
|
|
|
|
|
|
|
|
113 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunCodeceptionTests.php',
|
114 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunLocalCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php',
|
115 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\SedTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SedTrait.php',
|
|
|
116 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Plugin' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Plugin.php',
|
117 |
'FcfVendor\\WPDesk\\DeactivationModal\\Exception\\DuplicatedFormOptionKeyException' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-deactivation-modal/src/Exception/DuplicatedFormOptionKeyException.php',
|
118 |
'FcfVendor\\WPDesk\\DeactivationModal\\Exception\\DuplicatedFormValueKeyException' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-deactivation-modal/src/Exception/DuplicatedFormValueKeyException.php',
|
109 |
'FcfVendor\\WPDesk\\Codeception\\Command\\WooCommerceTestGenerator' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/WooCommerceTestGenerator.php',
|
110 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\CommandProvider' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php',
|
111 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\BaseCommand' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/BaseCommand.php',
|
112 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\Configuration' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/Configuration.php',
|
113 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\CreateCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/CreateCodeceptionTests.php',
|
114 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\LocalCodeceptionTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/LocalCodeceptionTrait.php',
|
115 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareCodeceptionDb' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareCodeceptionDb.php',
|
116 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareLocalCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareLocalCodeceptionTests.php',
|
117 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareParallelCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareParallelCodeceptionTests.php',
|
118 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareWordpressForCodeception' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareWordpressForCodeception.php',
|
119 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunCodeceptionTests.php',
|
120 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunLocalCodeceptionTests' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php',
|
121 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\SedTrait' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SedTrait.php',
|
122 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\SettingsException' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SettingsException.php',
|
123 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Plugin' => $baseDir . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Plugin.php',
|
124 |
'FcfVendor\\WPDesk\\DeactivationModal\\Exception\\DuplicatedFormOptionKeyException' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-deactivation-modal/src/Exception/DuplicatedFormOptionKeyException.php',
|
125 |
'FcfVendor\\WPDesk\\DeactivationModal\\Exception\\DuplicatedFormValueKeyException' => $baseDir . '/vendor_prefixed/wpdesk/wp-wpdesk-deactivation-modal/src/Exception/DuplicatedFormValueKeyException.php',
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -22,15 +22,15 @@ class ComposerAutoloaderInit314adafe5f5da6b81a709b14ac463e62
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
spl_autoload_register(array('
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
-
spl_autoload_unregister(array('
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
-
call_user_func(\Composer\Autoload\
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit0118c512262255eaa7e1fe5b40839be0
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInit0118c512262255eaa7e1fe5b40839be0', 'loadClassLoader'), true, true);
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit0118c512262255eaa7e1fe5b40839be0', 'loadClassLoader'));
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
require_once __DIR__ . '/autoload_static.php';
|
32 |
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit0118c512262255eaa7e1fe5b40839be0::getInitializer($loader));
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'W' =>
|
@@ -132,10 +132,17 @@ class ComposerStaticInit314adafe5f5da6b81a709b14ac463e62
|
|
132 |
'FcfVendor\\WPDesk\\Codeception\\Command\\WooCommerceTestGenerator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/WooCommerceTestGenerator.php',
|
133 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\CommandProvider' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php',
|
134 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\BaseCommand' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/BaseCommand.php',
|
|
|
135 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\CreateCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/CreateCodeceptionTests.php',
|
|
|
|
|
|
|
|
|
|
|
136 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunCodeceptionTests.php',
|
137 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunLocalCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php',
|
138 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\SedTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SedTrait.php',
|
|
|
139 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Plugin' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Plugin.php',
|
140 |
'FcfVendor\\WPDesk\\DeactivationModal\\Exception\\DuplicatedFormOptionKeyException' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-deactivation-modal/src/Exception/DuplicatedFormOptionKeyException.php',
|
141 |
'FcfVendor\\WPDesk\\DeactivationModal\\Exception\\DuplicatedFormValueKeyException' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-deactivation-modal/src/Exception/DuplicatedFormValueKeyException.php',
|
@@ -430,9 +437,9 @@ class ComposerStaticInit314adafe5f5da6b81a709b14ac463e62
|
|
430 |
public static function getInitializer(ClassLoader $loader)
|
431 |
{
|
432 |
return \Closure::bind(function () use ($loader) {
|
433 |
-
$loader->prefixLengthsPsr4 =
|
434 |
-
$loader->prefixDirsPsr4 =
|
435 |
-
$loader->classMap =
|
436 |
|
437 |
}, null, ClassLoader::class);
|
438 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit0118c512262255eaa7e1fe5b40839be0
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'W' =>
|
132 |
'FcfVendor\\WPDesk\\Codeception\\Command\\WooCommerceTestGenerator' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Codeception/Command/WooCommerceTestGenerator.php',
|
133 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\CommandProvider' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php',
|
134 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\BaseCommand' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/BaseCommand.php',
|
135 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\Configuration' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/Configuration.php',
|
136 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\CreateCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/CreateCodeceptionTests.php',
|
137 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\LocalCodeceptionTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/LocalCodeceptionTrait.php',
|
138 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareCodeceptionDb' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareCodeceptionDb.php',
|
139 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareLocalCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareLocalCodeceptionTests.php',
|
140 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareParallelCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareParallelCodeceptionTests.php',
|
141 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\PrepareWordpressForCodeception' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareWordpressForCodeception.php',
|
142 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunCodeceptionTests.php',
|
143 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\RunLocalCodeceptionTests' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php',
|
144 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\SedTrait' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SedTrait.php',
|
145 |
+
'FcfVendor\\WPDesk\\Composer\\Codeception\\Commands\\SettingsException' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SettingsException.php',
|
146 |
'FcfVendor\\WPDesk\\Composer\\Codeception\\Plugin' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Plugin.php',
|
147 |
'FcfVendor\\WPDesk\\DeactivationModal\\Exception\\DuplicatedFormOptionKeyException' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-deactivation-modal/src/Exception/DuplicatedFormOptionKeyException.php',
|
148 |
'FcfVendor\\WPDesk\\DeactivationModal\\Exception\\DuplicatedFormValueKeyException' => __DIR__ . '/../..' . '/vendor_prefixed/wpdesk/wp-wpdesk-deactivation-modal/src/Exception/DuplicatedFormValueKeyException.php',
|
437 |
public static function getInitializer(ClassLoader $loader)
|
438 |
{
|
439 |
return \Closure::bind(function () use ($loader) {
|
440 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit0118c512262255eaa7e1fe5b40839be0::$prefixLengthsPsr4;
|
441 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit0118c512262255eaa7e1fe5b40839be0::$prefixDirsPsr4;
|
442 |
+
$loader->classMap = ComposerStaticInit0118c512262255eaa7e1fe5b40839be0::$classMap;
|
443 |
|
444 |
}, null, ClassLoader::class);
|
445 |
}
|
vendor_prefixed/wpdesk/wp-codeception/composer.json
CHANGED
@@ -17,9 +17,8 @@
|
|
17 |
}
|
18 |
],
|
19 |
"require": {
|
20 |
-
"php": ">=
|
21 |
"ext-json": "*",
|
22 |
-
"wpdesk\/wp-builder": "^1.0",
|
23 |
"composer-plugin-api": "^1.1|^2",
|
24 |
"codeception\/module-db": "^1.0",
|
25 |
"codeception\/module-cli": "^1.0",
|
@@ -30,7 +29,13 @@
|
|
30 |
"codeception\/module-phpbrowser": "^1.0",
|
31 |
"codeception\/module-asserts": "^1.1",
|
32 |
"codeception\/util-universalframework": "^1.0",
|
33 |
-
"vlucas\/phpdotenv": "^4.
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
},
|
35 |
"require-dev": {
|
36 |
"phpunit\/phpunit": "<7",
|
17 |
}
|
18 |
],
|
19 |
"require": {
|
20 |
+
"php": ">=7.0",
|
21 |
"ext-json": "*",
|
|
|
22 |
"composer-plugin-api": "^1.1|^2",
|
23 |
"codeception\/module-db": "^1.0",
|
24 |
"codeception\/module-cli": "^1.0",
|
29 |
"codeception\/module-phpbrowser": "^1.0",
|
30 |
"codeception\/module-asserts": "^1.1",
|
31 |
"codeception\/util-universalframework": "^1.0",
|
32 |
+
"vlucas\/phpdotenv": "^4.2.0",
|
33 |
+
"albertofem\/rsync-lib": "^1.0",
|
34 |
+
"wp-cli\/wp-cli-bundle": "^2.4",
|
35 |
+
"symfony\/yaml": "^v3.4.47",
|
36 |
+
"lucatume\/codeception-steppify": "^1.0",
|
37 |
+
"wp-cli\/admin-command": "^2.0",
|
38 |
+
"bordoni\/phpass": "^0.3.5"
|
39 |
},
|
40 |
"require-dev": {
|
41 |
"phpunit\/phpunit": "<7",
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/CommandProvider.php
CHANGED
@@ -3,6 +3,10 @@
|
|
3 |
namespace FcfVendor\WPDesk\Composer\Codeception;
|
4 |
|
5 |
use FcfVendor\WPDesk\Composer\Codeception\Commands\CreateCodeceptionTests;
|
|
|
|
|
|
|
|
|
6 |
use FcfVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests;
|
7 |
use FcfVendor\WPDesk\Composer\Codeception\Commands\RunLocalCodeceptionTests;
|
8 |
/**
|
@@ -12,6 +16,6 @@ class CommandProvider implements \FcfVendor\Composer\Plugin\Capability\CommandPr
|
|
12 |
{
|
13 |
public function getCommands()
|
14 |
{
|
15 |
-
return [new \FcfVendor\WPDesk\Composer\Codeception\Commands\CreateCodeceptionTests(), new \FcfVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests(), new \FcfVendor\WPDesk\Composer\Codeception\Commands\RunLocalCodeceptionTests()];
|
16 |
}
|
17 |
}
|
3 |
namespace FcfVendor\WPDesk\Composer\Codeception;
|
4 |
|
5 |
use FcfVendor\WPDesk\Composer\Codeception\Commands\CreateCodeceptionTests;
|
6 |
+
use FcfVendor\WPDesk\Composer\Codeception\Commands\PrepareCodeceptionDb;
|
7 |
+
use FcfVendor\WPDesk\Composer\Codeception\Commands\PrepareLocalCodeceptionTests;
|
8 |
+
use FcfVendor\WPDesk\Composer\Codeception\Commands\PrepareParallelCodeceptionTests;
|
9 |
+
use FcfVendor\WPDesk\Composer\Codeception\Commands\PrepareWordpressForCodeception;
|
10 |
use FcfVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests;
|
11 |
use FcfVendor\WPDesk\Composer\Codeception\Commands\RunLocalCodeceptionTests;
|
12 |
/**
|
16 |
{
|
17 |
public function getCommands()
|
18 |
{
|
19 |
+
return [new \FcfVendor\WPDesk\Composer\Codeception\Commands\CreateCodeceptionTests(), new \FcfVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests(), new \FcfVendor\WPDesk\Composer\Codeception\Commands\RunLocalCodeceptionTests(), new \FcfVendor\WPDesk\Composer\Codeception\Commands\PrepareCodeceptionDb(), new \FcfVendor\WPDesk\Composer\Codeception\Commands\PrepareWordpressForCodeception(), new \FcfVendor\WPDesk\Composer\Codeception\Commands\PrepareLocalCodeceptionTests(), new \FcfVendor\WPDesk\Composer\Codeception\Commands\PrepareParallelCodeceptionTests()];
|
20 |
}
|
21 |
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/Configuration.php
ADDED
@@ -0,0 +1,360 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class Env
|
5 |
+
* @package WPDesk\Composer\Codeception\Commands
|
6 |
+
*/
|
7 |
+
namespace FcfVendor\WPDesk\Composer\Codeception\Commands;
|
8 |
+
|
9 |
+
use FcfVendor\Dotenv\Dotenv;
|
10 |
+
/**
|
11 |
+
* Env.
|
12 |
+
*/
|
13 |
+
class Configuration
|
14 |
+
{
|
15 |
+
const MYSQL_IP = 'MYSQL_IP';
|
16 |
+
const MYSQL_DBNAME = 'MYSQL_DBNAME';
|
17 |
+
const MYSQL_DBUSER = 'MYSQL_DBUSER';
|
18 |
+
const MYSQL_DBPASSWORD = 'MYSQL_DBPASSWORD';
|
19 |
+
const APACHE_DOCUMENT_ROOT = 'APACHE_DOCUMENT_ROOT';
|
20 |
+
const WOOTESTS_IP = 'WOOTESTS_IP';
|
21 |
+
const DEPENDENT_PLUGINS_DIR = 'DEPENDENT_PLUGINS_DIR';
|
22 |
+
/**
|
23 |
+
* @var string
|
24 |
+
*/
|
25 |
+
private $apache_document_root;
|
26 |
+
/**
|
27 |
+
* @var string
|
28 |
+
*/
|
29 |
+
private $wptests_ip;
|
30 |
+
/**
|
31 |
+
* @var string
|
32 |
+
*/
|
33 |
+
private $dbhost;
|
34 |
+
/**
|
35 |
+
* @var string
|
36 |
+
*/
|
37 |
+
private $dbname;
|
38 |
+
/**
|
39 |
+
* @var string
|
40 |
+
*/
|
41 |
+
private $dbuser;
|
42 |
+
/**
|
43 |
+
* @var string
|
44 |
+
*/
|
45 |
+
private $dbpassword;
|
46 |
+
/**
|
47 |
+
* @var string
|
48 |
+
*/
|
49 |
+
private $dependent_plugins_dir;
|
50 |
+
/**
|
51 |
+
* @var string
|
52 |
+
*/
|
53 |
+
private $plugin_slug;
|
54 |
+
/**
|
55 |
+
* @var string
|
56 |
+
*/
|
57 |
+
private $plugin_dir;
|
58 |
+
/**
|
59 |
+
* @var string
|
60 |
+
*/
|
61 |
+
private $plugin_file;
|
62 |
+
/**
|
63 |
+
* @var string
|
64 |
+
*/
|
65 |
+
private $plugin_title;
|
66 |
+
/**
|
67 |
+
* @var string
|
68 |
+
*/
|
69 |
+
private $plugin_product_id;
|
70 |
+
/**
|
71 |
+
* @var array
|
72 |
+
*/
|
73 |
+
private $repository_plugins;
|
74 |
+
/**
|
75 |
+
* @var array
|
76 |
+
*/
|
77 |
+
private $local_plugins;
|
78 |
+
/**
|
79 |
+
* @var array
|
80 |
+
*/
|
81 |
+
private $activate_plugins;
|
82 |
+
/**
|
83 |
+
* @var array
|
84 |
+
*/
|
85 |
+
private $prepare_database;
|
86 |
+
/**
|
87 |
+
* @var array
|
88 |
+
*/
|
89 |
+
private $theme_files;
|
90 |
+
/**
|
91 |
+
* Configuration constructor.
|
92 |
+
*
|
93 |
+
* @param $apache_document_root
|
94 |
+
* @param $wptests_ip
|
95 |
+
* @param $dbhost
|
96 |
+
* @param $dbname
|
97 |
+
* @param $dbuser
|
98 |
+
* @param $dbpassword
|
99 |
+
* @param $dependent_plugins_dir
|
100 |
+
* @param $plugin_slug
|
101 |
+
* @param $plugin_dir
|
102 |
+
* @param $plugin_file
|
103 |
+
* @param $plugin_title
|
104 |
+
* @param $plugin_product_id
|
105 |
+
* @param $repository_plugins
|
106 |
+
* @param $local_plugins
|
107 |
+
* @param $activate_plugins
|
108 |
+
* @param $prepare_database
|
109 |
+
* @param $theme_files
|
110 |
+
*/
|
111 |
+
public function __construct($apache_document_root, $wptests_ip, $dbhost, $dbname, $dbuser, $dbpassword, $dependent_plugins_dir, $plugin_slug, $plugin_dir, $plugin_file, $plugin_title, $plugin_product_id, $repository_plugins, $local_plugins, $activate_plugins, $prepare_database, $theme_files)
|
112 |
+
{
|
113 |
+
$this->apache_document_root = $apache_document_root;
|
114 |
+
$this->wptests_ip = $wptests_ip;
|
115 |
+
$this->dbhost = $dbhost;
|
116 |
+
$this->dbname = $dbname;
|
117 |
+
$this->dbuser = $dbuser;
|
118 |
+
$this->dbpassword = $dbpassword;
|
119 |
+
$this->dependent_plugins_dir = $dependent_plugins_dir;
|
120 |
+
$this->plugin_slug = $plugin_slug;
|
121 |
+
$this->plugin_dir = $plugin_dir;
|
122 |
+
$this->plugin_file = $plugin_file;
|
123 |
+
$this->plugin_title = $plugin_title;
|
124 |
+
$this->plugin_product_id = $plugin_product_id;
|
125 |
+
$this->repository_plugins = $repository_plugins;
|
126 |
+
$this->local_plugins = $local_plugins;
|
127 |
+
$this->activate_plugins = $activate_plugins;
|
128 |
+
$this->prepare_database = $prepare_database;
|
129 |
+
$this->theme_files = $theme_files;
|
130 |
+
}
|
131 |
+
/**
|
132 |
+
* @return string
|
133 |
+
*/
|
134 |
+
public function getApacheDocumentRoot()
|
135 |
+
{
|
136 |
+
return $this->apache_document_root;
|
137 |
+
}
|
138 |
+
/**
|
139 |
+
* @return string
|
140 |
+
*/
|
141 |
+
public function getWptestsIp()
|
142 |
+
{
|
143 |
+
return $this->wptests_ip;
|
144 |
+
}
|
145 |
+
/**
|
146 |
+
* @return string
|
147 |
+
*/
|
148 |
+
public function getDbhost()
|
149 |
+
{
|
150 |
+
return $this->dbhost;
|
151 |
+
}
|
152 |
+
/**
|
153 |
+
* @return string
|
154 |
+
*/
|
155 |
+
public function getDbname()
|
156 |
+
{
|
157 |
+
return $this->dbname;
|
158 |
+
}
|
159 |
+
/**
|
160 |
+
* @return string
|
161 |
+
*/
|
162 |
+
public function getDbuser()
|
163 |
+
{
|
164 |
+
return $this->dbuser;
|
165 |
+
}
|
166 |
+
/**
|
167 |
+
* @return string
|
168 |
+
*/
|
169 |
+
public function getDbpassword()
|
170 |
+
{
|
171 |
+
return $this->dbpassword;
|
172 |
+
}
|
173 |
+
/**
|
174 |
+
* @return string
|
175 |
+
*/
|
176 |
+
public function getDependentPluginsDir()
|
177 |
+
{
|
178 |
+
return $this->dependent_plugins_dir;
|
179 |
+
}
|
180 |
+
/**
|
181 |
+
* @return string
|
182 |
+
*/
|
183 |
+
public function getPluginSlug()
|
184 |
+
{
|
185 |
+
return $this->plugin_slug;
|
186 |
+
}
|
187 |
+
/**
|
188 |
+
* @return string
|
189 |
+
*/
|
190 |
+
public function getPluginDir()
|
191 |
+
{
|
192 |
+
return $this->plugin_dir;
|
193 |
+
}
|
194 |
+
/**
|
195 |
+
* @return string
|
196 |
+
*/
|
197 |
+
public function getPluginFile()
|
198 |
+
{
|
199 |
+
return $this->plugin_file;
|
200 |
+
}
|
201 |
+
/**
|
202 |
+
* @return string
|
203 |
+
*/
|
204 |
+
public function getPluginTitle()
|
205 |
+
{
|
206 |
+
return $this->plugin_title;
|
207 |
+
}
|
208 |
+
/**
|
209 |
+
* @return string
|
210 |
+
*/
|
211 |
+
public function getPluginProductId()
|
212 |
+
{
|
213 |
+
return $this->plugin_product_id;
|
214 |
+
}
|
215 |
+
/**
|
216 |
+
* @return array
|
217 |
+
*/
|
218 |
+
public function getRepositoryPlugins()
|
219 |
+
{
|
220 |
+
return $this->repository_plugins;
|
221 |
+
}
|
222 |
+
/**
|
223 |
+
* @return array
|
224 |
+
*/
|
225 |
+
public function getLocalPlugins()
|
226 |
+
{
|
227 |
+
return $this->local_plugins;
|
228 |
+
}
|
229 |
+
/**
|
230 |
+
* @return array
|
231 |
+
*/
|
232 |
+
public function getActivatePlugins()
|
233 |
+
{
|
234 |
+
return $this->activate_plugins;
|
235 |
+
}
|
236 |
+
/**
|
237 |
+
* @return array
|
238 |
+
*/
|
239 |
+
public function getPrepareDatabase()
|
240 |
+
{
|
241 |
+
return $this->prepare_database;
|
242 |
+
}
|
243 |
+
/**
|
244 |
+
* @return array
|
245 |
+
*/
|
246 |
+
public function getThemeFiles()
|
247 |
+
{
|
248 |
+
return $this->theme_files;
|
249 |
+
}
|
250 |
+
/**
|
251 |
+
* Set env variables from configuration.
|
252 |
+
*/
|
253 |
+
public function prepareEnvForConfiguration()
|
254 |
+
{
|
255 |
+
$this->putEnv('WPDESK_PLUGIN_SLUG', $this->getPluginSlug());
|
256 |
+
$this->putEnv('WPDESK_PLUGIN_FILE', $this->getPluginFile());
|
257 |
+
$this->putEnv('WPDESK_PLUGIN_TITLE', $this->getPluginTitle());
|
258 |
+
$this->putEnv('WPDESK_PLUGIN_PRODUCT_ID', $this->getPluginProductId());
|
259 |
+
}
|
260 |
+
/**
|
261 |
+
* @param string $env_variable
|
262 |
+
* @param string $value
|
263 |
+
*
|
264 |
+
* @return string
|
265 |
+
*/
|
266 |
+
private function putEnv($env_variable, $value)
|
267 |
+
{
|
268 |
+
\putenv($env_variable . '=' . $value);
|
269 |
+
}
|
270 |
+
/**
|
271 |
+
* @param array $configuration .
|
272 |
+
*
|
273 |
+
* @return Configuration
|
274 |
+
*/
|
275 |
+
public static function createFromEnvAndConfiguration(array $configuration)
|
276 |
+
{
|
277 |
+
$dotenv = \FcfVendor\Dotenv\Dotenv::createImmutable(\getcwd() . '/../');
|
278 |
+
$dotenv->safeLoad();
|
279 |
+
$apache_document_root = self::prepareFromEnv(self::APACHE_DOCUMENT_ROOT, self::prepareApacheDocumentRoot());
|
280 |
+
$wptests_ip = self::prepareFromEnv(self::WOOTESTS_IP, 'wptests.lh');
|
281 |
+
$dbhost = self::prepareFromEnv(self::MYSQL_IP, 'mysqltests');
|
282 |
+
$dbname = self::prepareFromEnv(self::MYSQL_DBNAME, 'wptest');
|
283 |
+
$dbuser = self::prepareFromEnv(self::MYSQL_DBUSER, 'mysql');
|
284 |
+
$dbpassword = self::prepareFromEnv(self::MYSQL_DBPASSWORD, 'mysql');
|
285 |
+
$dependent_plugins_dir = self::prepareFromEnv(self::DEPENDENT_PLUGINS_DIR, '../');
|
286 |
+
if (isset($configuration['plugin-slug'])) {
|
287 |
+
$plugin_slug = $configuration['plugin-slug'];
|
288 |
+
} else {
|
289 |
+
throw new \FcfVendor\WPDesk\Composer\Codeception\Commands\SettingsException('Missing plugin-slug setting!');
|
290 |
+
}
|
291 |
+
if (isset($configuration['plugin-file'])) {
|
292 |
+
$plugin_file = $configuration['plugin-file'];
|
293 |
+
} else {
|
294 |
+
throw new \FcfVendor\WPDesk\Composer\Codeception\Commands\SettingsException('Missing plugin-file setting!');
|
295 |
+
}
|
296 |
+
$plugin_file_exploded = \explode('/', $plugin_file);
|
297 |
+
$plugin_dir = $plugin_file_exploded[0];
|
298 |
+
if (isset($configuration['plugin-title'])) {
|
299 |
+
$plugin_title = $configuration['plugin-title'];
|
300 |
+
} else {
|
301 |
+
throw new \FcfVendor\WPDesk\Composer\Codeception\Commands\SettingsException('Missing plugin-title setting!');
|
302 |
+
}
|
303 |
+
if (isset($configuration['plugin-product-id'])) {
|
304 |
+
$plugin_product_id = $configuration['plugin-product-id'];
|
305 |
+
} else {
|
306 |
+
$plugin_product_id = '';
|
307 |
+
}
|
308 |
+
$prepare_database = array();
|
309 |
+
if (isset($configuration['prepare-database']) && \is_array($configuration['prepare-database'])) {
|
310 |
+
$prepare_database = $configuration['prepare-database'];
|
311 |
+
}
|
312 |
+
$theme_files = array();
|
313 |
+
if (isset($configuration['theme-files']) && \is_array($configuration['theme-files'])) {
|
314 |
+
$theme_files = $configuration['theme-files'];
|
315 |
+
}
|
316 |
+
$repository_plugins = self::getPluginsSettings($configuration, 'repository');
|
317 |
+
$local_plugins = self::getPluginsSettings($configuration, 'local');
|
318 |
+
$activate_plugins = self::getPluginsSettings($configuration, 'activate');
|
319 |
+
return new self($apache_document_root, $wptests_ip, $dbhost, $dbname, $dbuser, $dbpassword, $dependent_plugins_dir, $plugin_slug, $plugin_dir, $plugin_file, $plugin_title, $plugin_product_id, $repository_plugins, $local_plugins, $activate_plugins, $prepare_database, $theme_files);
|
320 |
+
}
|
321 |
+
/**
|
322 |
+
* @param string $env_variable .
|
323 |
+
* @param string $default_value .
|
324 |
+
*
|
325 |
+
* @return string
|
326 |
+
*/
|
327 |
+
private static function prepareFromEnv($env_variable, $default_value)
|
328 |
+
{
|
329 |
+
$value = \getenv($env_variable);
|
330 |
+
$value = $value ? $value : $default_value;
|
331 |
+
return $value;
|
332 |
+
}
|
333 |
+
/**
|
334 |
+
* @return string
|
335 |
+
*/
|
336 |
+
private static function prepareApacheDocumentRoot()
|
337 |
+
{
|
338 |
+
return self::isWindows() ? 'c:\\xampp\\htdocs\\wptests' : '/tmp/wptests';
|
339 |
+
}
|
340 |
+
/**
|
341 |
+
* @return bool
|
342 |
+
*/
|
343 |
+
public static function isWindows()
|
344 |
+
{
|
345 |
+
return \false !== \stristr(\PHP_OS, 'WIN') && \false === \stristr(\PHP_OS, 'DARWIN');
|
346 |
+
}
|
347 |
+
/**
|
348 |
+
* @param array $configuration .
|
349 |
+
* @param string $plugins_section .
|
350 |
+
*
|
351 |
+
* @return array
|
352 |
+
*/
|
353 |
+
private static function getPluginsSettings(array $configuration, $plugins_section)
|
354 |
+
{
|
355 |
+
if (\is_array($configuration) && isset($configuration['plugins'], $configuration['plugins'][$plugins_section]) && \is_array($configuration['plugins'][$plugins_section])) {
|
356 |
+
return $configuration['plugins'][$plugins_section];
|
357 |
+
}
|
358 |
+
return array();
|
359 |
+
}
|
360 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/LocalCodeceptionTrait.php
ADDED
@@ -0,0 +1,213 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FcfVendor\WPDesk\Composer\Codeception\Commands;
|
4 |
+
|
5 |
+
use FcfVendor\Symfony\Component\Console\Output\OutputInterface;
|
6 |
+
use FcfVendor\Symfony\Component\Yaml\Exception\ParseException;
|
7 |
+
use FcfVendor\Symfony\Component\Yaml\Yaml;
|
8 |
+
/**
|
9 |
+
* Common methods for local Codeception tests.
|
10 |
+
*/
|
11 |
+
trait LocalCodeceptionTrait
|
12 |
+
{
|
13 |
+
private function getWpDeskConfiguration()
|
14 |
+
{
|
15 |
+
try {
|
16 |
+
$wpdesk_configuration = \FcfVendor\Symfony\Component\Yaml\Yaml::parseFile(\getcwd() . '/tests/codeception/wpdesk.yml');
|
17 |
+
} catch (\FcfVendor\Symfony\Component\Yaml\Exception\ParseException $e) {
|
18 |
+
$wpdesk_configuration = array();
|
19 |
+
}
|
20 |
+
return \FcfVendor\WPDesk\Composer\Codeception\Commands\Configuration::createFromEnvAndConfiguration($wpdesk_configuration);
|
21 |
+
}
|
22 |
+
/**
|
23 |
+
* @param OutputInterface $output
|
24 |
+
* @param Configuration $configuration
|
25 |
+
*/
|
26 |
+
private function prepareWpConfig(\FcfVendor\Symfony\Component\Console\Output\OutputInterface $output, \FcfVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
27 |
+
{
|
28 |
+
$apache_document_root = $configuration->getApacheDocumentRoot();
|
29 |
+
$this->executeWpCliAndOutput('config set WP_DEBUG true --raw', $output, $apache_document_root);
|
30 |
+
$this->executeWpCliAndOutput('config set WP_DEBUG_LOG true --raw', $output, $apache_document_root);
|
31 |
+
$this->executeWpCliAndOutput('config set WP_DEBUG_DISPLAY true --raw', $output, $apache_document_root);
|
32 |
+
$this->executeWpCliAndOutput('config set WP_HOME http://' . $configuration->getWptestsIp(), $output, $apache_document_root);
|
33 |
+
$this->executeWpCliAndOutput('config set WP_SITEURL http://' . $configuration->getWptestsIp(), $output, $apache_document_root);
|
34 |
+
$this->executeWpCliAndOutput('config set WP_AUTO_UPDATE_CORE false --raw', $output, $apache_document_root);
|
35 |
+
$this->executeWpCliAndOutput('config set AUTOMATIC_UPDATER_DISABLED false --raw', $output, $apache_document_root);
|
36 |
+
}
|
37 |
+
/**
|
38 |
+
* @param OutputInterface $output
|
39 |
+
* @param Configuration $configuration
|
40 |
+
*/
|
41 |
+
private function activatePlugins(\FcfVendor\Symfony\Component\Console\Output\OutputInterface $output, \FcfVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
42 |
+
{
|
43 |
+
$this->executeWpCliAndOutput('plugin deactivate --all', $output, $configuration->getApacheDocumentRoot());
|
44 |
+
$plugins = '';
|
45 |
+
foreach ($configuration->getRepositoryPlugins() as $plugin) {
|
46 |
+
$plugins .= ' ' . $plugin;
|
47 |
+
}
|
48 |
+
if ($plugins) {
|
49 |
+
$this->executeWpCliAndOutput('plugin install ' . $plugins, $output, $configuration->getApacheDocumentRoot());
|
50 |
+
}
|
51 |
+
foreach ($configuration->getLocalPlugins() as $plugin) {
|
52 |
+
$source = $this->preparePathForRsync($this->prepareLocalPluginDir($plugin, $configuration->getDependentPluginsDir()) . '/*', $configuration::isWindows());
|
53 |
+
$target = $this->preparePathForRsync($this->prepareTargetDir($plugin, $configuration) . '/', $configuration::isWindows());
|
54 |
+
$rsync = 'rsync -a ' . $source . ' ' . $target . ' --exclude=node_modules --exclude=.git --exclude=tests --exclude=.idea';
|
55 |
+
$output->writeln($rsync);
|
56 |
+
$this->execAndOutput($rsync, $output);
|
57 |
+
}
|
58 |
+
foreach ($configuration->getActivatePlugins() as $plugin) {
|
59 |
+
$this->executeWpCliAndOutput('plugin activate ' . $plugin, $output, $configuration->getApacheDocumentRoot());
|
60 |
+
}
|
61 |
+
$this->executeWpCliAndOutput('plugin activate ' . $configuration->getPluginDir(), $output, $configuration->getApacheDocumentRoot());
|
62 |
+
}
|
63 |
+
/**
|
64 |
+
* @param string $plugin .
|
65 |
+
*/
|
66 |
+
private function prepareLocalPluginDir($plugin, $local_plugins_dir = \false)
|
67 |
+
{
|
68 |
+
if (!$local_plugins_dir) {
|
69 |
+
$local_plugins_dir = \dirname(\getcwd());
|
70 |
+
}
|
71 |
+
return $this->trailingslashit($local_plugins_dir) . $plugin;
|
72 |
+
}
|
73 |
+
/**
|
74 |
+
* @param $string
|
75 |
+
*
|
76 |
+
* @return string
|
77 |
+
*/
|
78 |
+
private function trailingslashit($string)
|
79 |
+
{
|
80 |
+
return \rtrim($string, '/\\') . '/';
|
81 |
+
}
|
82 |
+
/**
|
83 |
+
* @param string $command
|
84 |
+
* @param OutputInterface $output
|
85 |
+
* @param string $apache_document_root
|
86 |
+
*/
|
87 |
+
private function executeWpCliAndOutput($command, \FcfVendor\Symfony\Component\Console\Output\OutputInterface $output, $apache_document_root)
|
88 |
+
{
|
89 |
+
$output->write("WPCLI: {$command}\n");
|
90 |
+
$sep = \DIRECTORY_SEPARATOR;
|
91 |
+
$wp = "php vendor{$sep}wp-cli{$sep}wp-cli{$sep}php{$sep}boot-fs.php";
|
92 |
+
$command = $wp . ' ' . $command . ' --allow-root --path=' . $apache_document_root;
|
93 |
+
$this->execAndOutput($command, $output);
|
94 |
+
}
|
95 |
+
/**
|
96 |
+
* @param string $plugin_dir
|
97 |
+
* @param OutputInterface $output
|
98 |
+
* @param Configuration $configuration
|
99 |
+
*/
|
100 |
+
private function installPlugin($plugin_dir, \FcfVendor\Symfony\Component\Console\Output\OutputInterface $output, \FcfVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
101 |
+
{
|
102 |
+
$source = $this->preparePathForRsync(\getcwd() . '/*', $configuration::isWindows());
|
103 |
+
$target = $this->preparePathForRsync($this->prepareTargetDir($plugin_dir, $configuration) . '/', $configuration::isWindows());
|
104 |
+
$rsync = 'rsync -a ' . $source . ' ' . $target . ' --exclude=node_modules --exclude=.git --exclude=tests --exclude=.idea --exclude=vendor';
|
105 |
+
$this->execAndOutput($rsync, $output);
|
106 |
+
$this->execAndOutput('composer install --no-dev --working-dir=' . $configuration->getApacheDocumentRoot() . '/wp-content/plugins/' . $plugin_dir, $output);
|
107 |
+
}
|
108 |
+
/**
|
109 |
+
* @param string $path
|
110 |
+
* @param bool $is_windows
|
111 |
+
*
|
112 |
+
* @return string
|
113 |
+
*/
|
114 |
+
private function preparePathForRsync($path, $is_windows)
|
115 |
+
{
|
116 |
+
if ($is_windows) {
|
117 |
+
$path = '/cygdrive/' . $path;
|
118 |
+
$path = \str_replace(':', '', $path);
|
119 |
+
$path = \str_replace('\\', '/', $path);
|
120 |
+
}
|
121 |
+
return $path;
|
122 |
+
}
|
123 |
+
/**
|
124 |
+
* @param string $plugin_slug
|
125 |
+
* @param Configuration $configuration
|
126 |
+
*
|
127 |
+
* @return string
|
128 |
+
*/
|
129 |
+
private function prepareTargetDir($plugin_slug, \FcfVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
130 |
+
{
|
131 |
+
return $configuration->getApacheDocumentRoot() . '/wp-content/plugins/' . $plugin_slug;
|
132 |
+
}
|
133 |
+
/**
|
134 |
+
* @param Configuration $configuration
|
135 |
+
* @param OutputInterface $output
|
136 |
+
*/
|
137 |
+
private function prepareCommonWpWcConfiguration(\FcfVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration, \FcfVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
138 |
+
{
|
139 |
+
$this->executeWpCliAndOutput('db reset --yes', $output, $configuration->getApacheDocumentRoot());
|
140 |
+
$this->executeWpCliAndOutput('core install --url=' . $configuration->getWptestsIp() . ' --title=Woo-tests --admin_user=admin --admin_password=admin --admin_email=grola@seostudio.pl --skip-email', $output, $configuration->getApacheDocumentRoot());
|
141 |
+
$commands = array('theme activate storefront-wpdesk-tests', 'plugin activate woocommerce');
|
142 |
+
$commands = \array_merge($commands, $this->prepareWcOptionsCommands(), $this->prepareTaxes(), $this->prepareShippingMethods(), $this->prepareWooCommercePages(), $this->prepareCustomer(), $this->prepareDisableRESTApiPermissions(), $this->prepareCreateProductsCommands(), $configuration->getPrepareDatabase());
|
143 |
+
foreach ($commands as $command) {
|
144 |
+
$this->executeWpCliAndOutput($command, $output, $configuration->getApacheDocumentRoot());
|
145 |
+
}
|
146 |
+
}
|
147 |
+
/**
|
148 |
+
* @return array
|
149 |
+
*/
|
150 |
+
private function prepareWcOptionsCommands()
|
151 |
+
{
|
152 |
+
return array('option update woocommerce_admin_notices \'{}\'', 'option update storefront_nux_dismissed 1', 'option set woocommerce_store_address "al. Jana Pawła 12"', 'option set woocommerce_store_address_2 ""', 'option set woocommerce_store_city "Warszawa"', 'option set woocommerce_default_country "PL"', 'option set woocommerce_store_postalcode "22-100"', 'option set woocommerce_currency "PLN"', 'option set woocommerce_currency_pos "right_space"', 'option set woocommerce_product_type "physical"', 'option set woocommerce_allow_tracking "no"', 'option set --format=json woocommerce_stripe_settings \'{"enabled":"no","create_account":false,"email":false}\'', 'option set --format=json woocommerce_ppec_paypal_settings \'{"reroute_requests":false,"email":false}\'', 'option set --format=json woocommerce_cheque_settings \'{"enabled":"no"}\'', 'option set --format=json woocommerce_bacs_settings \'{"enabled":"no"}\'', 'option set --format=json woocommerce_cod_settings \'{"enabled":"yes"}\'', 'option set --format=json woocommerce_onboarding_profile \'{"skipped":true}\'', 'option set --format=json wc-admin-onboarding-profiler-reminder \'{"skipped":true}\'', 'option get woocommerce_onboarding_profile', 'option set woocommerce_task_list_hidden "yes"');
|
153 |
+
}
|
154 |
+
/**
|
155 |
+
* @return string[]
|
156 |
+
*/
|
157 |
+
private function prepareTaxes()
|
158 |
+
{
|
159 |
+
return array('wc tax create --country="PL" --rate=23 --name=VAT --shipping=true --user=admin', 'option set woocommerce_calc_taxes "yes"');
|
160 |
+
}
|
161 |
+
/**
|
162 |
+
* @return string[]
|
163 |
+
*/
|
164 |
+
private function prepareShippingMethods()
|
165 |
+
{
|
166 |
+
return array('wc shipping_zone_method create 0 --method_id="flat_rate" --settings=\'{"title": "Flat rate", "cost":1, "tax_status": "taxable"}\' --enabled=true --user=admin');
|
167 |
+
}
|
168 |
+
/**
|
169 |
+
* @return string[]
|
170 |
+
*/
|
171 |
+
private function prepareWooCommercePages()
|
172 |
+
{
|
173 |
+
return array('wc --user=admin tool run install_pages');
|
174 |
+
}
|
175 |
+
/**
|
176 |
+
* @return string[]
|
177 |
+
*/
|
178 |
+
private function prepareCustomer()
|
179 |
+
{
|
180 |
+
return array('wc customer create --email=\'customer@woo.local\' --username="customer" --billing=\'{"first_name":"First","last_name":"Last","company":"WPDesk","address_1":"Street 1","city":"City","postcode": "53-030", "country": "PL", "phone": "012345678"}\' --password=\'customer\' --user=admin');
|
181 |
+
}
|
182 |
+
/**
|
183 |
+
* @return string[]
|
184 |
+
*/
|
185 |
+
private function prepareDisableRESTApiPermissions()
|
186 |
+
{
|
187 |
+
return array('option set wpdesk_rest_api_disable_permissions "1"');
|
188 |
+
}
|
189 |
+
/**
|
190 |
+
* @return array
|
191 |
+
*/
|
192 |
+
private function prepareCreateProductsCommands()
|
193 |
+
{
|
194 |
+
return array($this->prepareCreateProductCommand('100', '100'), $this->prepareCreateProductCommand('10', '10'), $this->prepareCreateProductCommand('9', '9'), $this->prepareCreateProductCommand('1', '1'), $this->prepareCreateProductCommand('09', '0.9'), $this->prepareCreateProductCommand('009', '0.09'), $this->prepareCreateProductCommand('01', '0.1'), $this->prepareCreateProductCommand('001', '0.01'), $this->prepareCreateProductCommand('0001', '0.001'), $this->prepareCreateProductCommand('00001', '0.0001'));
|
195 |
+
}
|
196 |
+
/**
|
197 |
+
* @param string $name
|
198 |
+
* @param string $price
|
199 |
+
* @param null|string $weight
|
200 |
+
* @param null|string $sku
|
201 |
+
* @param null|string $dimensions
|
202 |
+
*
|
203 |
+
* @return string
|
204 |
+
*/
|
205 |
+
private function prepareCreateProductCommand($name, $price, $weight = null, $sku = null, $dimensions = null)
|
206 |
+
{
|
207 |
+
$product_name = "Product {$name}";
|
208 |
+
$weight = $weight ? $weight : $price;
|
209 |
+
$sku = $sku ? $sku : 'product-' . $name;
|
210 |
+
$dimensions = $dimensions ? $dimensions : '{"width":"' . $price . '","length":"' . $price . '","height":"' . $price . '"}';
|
211 |
+
return "wc product create --name=\"{$product_name}\" --virtual=false --downloadable=false --type=simple --sku={$sku} --regular_price={$price} --weight={$weight} --dimensions='{$dimensions}' --user=admin";
|
212 |
+
}
|
213 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareCodeceptionDb.php
ADDED
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FcfVendor\WPDesk\Composer\Codeception\Commands;
|
4 |
+
|
5 |
+
use FcfVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
+
use FcfVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
+
use FcfVendor\Symfony\Component\Console\Output\OutputInterface;
|
8 |
+
use FcfVendor\Symfony\Component\Yaml\Exception\ParseException;
|
9 |
+
use FcfVendor\Symfony\Component\Yaml\Yaml;
|
10 |
+
/**
|
11 |
+
* Prepare Database for Codeception tests command.
|
12 |
+
*
|
13 |
+
* @package WPDesk\Composer\Codeception\Commands
|
14 |
+
*/
|
15 |
+
class PrepareCodeceptionDb extends \FcfVendor\WPDesk\Composer\Codeception\Commands\BaseCommand
|
16 |
+
{
|
17 |
+
use LocalCodeceptionTrait;
|
18 |
+
/**
|
19 |
+
* Configure command.
|
20 |
+
*/
|
21 |
+
protected function configure()
|
22 |
+
{
|
23 |
+
parent::configure();
|
24 |
+
$this->setName('prepare-codeception-db')->setDescription('Prepare codeception database.');
|
25 |
+
}
|
26 |
+
/**
|
27 |
+
* Execute command.
|
28 |
+
*
|
29 |
+
* @param InputInterface $input
|
30 |
+
* @param OutputInterface $output
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
protected function execute(\FcfVendor\Symfony\Component\Console\Input\InputInterface $input, \FcfVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
34 |
+
{
|
35 |
+
$configuration = $this->getWpDeskConfiguration();
|
36 |
+
$this->installPlugin($configuration->getPluginDir(), $output, $configuration);
|
37 |
+
$this->prepareCommonWpWcConfiguration($configuration, $output);
|
38 |
+
$this->prepareWpConfig($output, $configuration);
|
39 |
+
$this->executeWpCliAndOutput('plugin activate ' . $configuration->getPluginSlug(), $output, $configuration->getApacheDocumentRoot());
|
40 |
+
$this->activatePlugins($output, $configuration);
|
41 |
+
$this->executeWpCliAndOutput('db export ' . \getcwd() . '/tests/codeception/tests/_data/db.sql', $output, $configuration->getApacheDocumentRoot());
|
42 |
+
}
|
43 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareLocalCodeceptionTests.php
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FcfVendor\WPDesk\Composer\Codeception\Commands;
|
4 |
+
|
5 |
+
use FcfVendor\Composer\Downloader\FilesystemException;
|
6 |
+
use FcfVendor\Symfony\Component\Console\Input\InputArgument;
|
7 |
+
use FcfVendor\Symfony\Component\Console\Input\InputInterface;
|
8 |
+
use FcfVendor\Symfony\Component\Console\Output\OutputInterface;
|
9 |
+
use FcfVendor\Symfony\Component\Yaml\Exception\ParseException;
|
10 |
+
use FcfVendor\Symfony\Component\Yaml\Yaml;
|
11 |
+
/**
|
12 |
+
* Codeception tests run command.
|
13 |
+
*
|
14 |
+
* @package WPDesk\Composer\Codeception\Commands
|
15 |
+
*/
|
16 |
+
class PrepareLocalCodeceptionTests extends \FcfVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests
|
17 |
+
{
|
18 |
+
use LocalCodeceptionTrait;
|
19 |
+
/**
|
20 |
+
* Configure command.
|
21 |
+
*/
|
22 |
+
protected function configure()
|
23 |
+
{
|
24 |
+
parent::configure();
|
25 |
+
$this->setName('prepare-local-codeception-tests')->setDescription('Prepare local codeception tests.');
|
26 |
+
}
|
27 |
+
/**
|
28 |
+
* Execute command.
|
29 |
+
*
|
30 |
+
* @param InputInterface $input
|
31 |
+
* @param OutputInterface $output
|
32 |
+
* @return void
|
33 |
+
*/
|
34 |
+
protected function execute(\FcfVendor\Symfony\Component\Console\Input\InputInterface $input, \FcfVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
35 |
+
{
|
36 |
+
$configuration = $this->getWpDeskConfiguration();
|
37 |
+
$this->installPlugin($configuration->getPluginDir(), $output, $configuration);
|
38 |
+
$this->activatePlugins($output, $configuration);
|
39 |
+
$this->prepareWpConfig($output, $configuration);
|
40 |
+
$this->copyThemeFiles($configuration->getThemeFiles(), $configuration->getApacheDocumentRoot() . '/wp-content/themes/storefront-wpdesk-tests');
|
41 |
+
$sep = \DIRECTORY_SEPARATOR;
|
42 |
+
$codecept = "vendor{$sep}bin{$sep}codecept";
|
43 |
+
$cleanOutput = $codecept . ' clean';
|
44 |
+
$this->execAndOutput($cleanOutput, $output);
|
45 |
+
}
|
46 |
+
/**
|
47 |
+
* @param array $theme_files
|
48 |
+
* @param $theme_folder
|
49 |
+
*
|
50 |
+
* @throws FilesystemException
|
51 |
+
*/
|
52 |
+
private function copyThemeFiles(array $theme_files, $theme_folder)
|
53 |
+
{
|
54 |
+
foreach ($theme_files as $theme_file) {
|
55 |
+
if (!\copy($theme_file, $this->trailingslashit($theme_folder) . \basename($theme_file))) {
|
56 |
+
throw new \FcfVendor\Composer\Downloader\FilesystemException('Error copying theme file: ' . $theme_file);
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareParallelCodeceptionTests.php
ADDED
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FcfVendor\WPDesk\Composer\Codeception\Commands;
|
4 |
+
|
5 |
+
use FcfVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
+
use FcfVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
+
use FcfVendor\Symfony\Component\Console\Output\OutputInterface;
|
8 |
+
use FcfVendor\Symfony\Component\Yaml\Exception\ParseException;
|
9 |
+
use FcfVendor\Symfony\Component\Yaml\Yaml;
|
10 |
+
/**
|
11 |
+
* Split test to multiple directories for parallel running in CI.
|
12 |
+
*
|
13 |
+
* @package WPDesk\Composer\Codeception\Commands
|
14 |
+
*/
|
15 |
+
class PrepareParallelCodeceptionTests extends \FcfVendor\WPDesk\Composer\Codeception\Commands\BaseCommand
|
16 |
+
{
|
17 |
+
const NUMBER_OF_JOBS = 'number_of_jobs';
|
18 |
+
/**
|
19 |
+
* Configure command.
|
20 |
+
*/
|
21 |
+
protected function configure()
|
22 |
+
{
|
23 |
+
parent::configure();
|
24 |
+
$this->setName('prepare-parallel-codeception-tests')->setDescription('Prepare parallel codeception tests.')->setDefinition(array(new \FcfVendor\Symfony\Component\Console\Input\InputArgument(self::NUMBER_OF_JOBS, \FcfVendor\Symfony\Component\Console\Input\InputArgument::OPTIONAL, 'Number of jobs.', '4')));
|
25 |
+
}
|
26 |
+
/**
|
27 |
+
* Execute command.
|
28 |
+
*
|
29 |
+
* @param InputInterface $input
|
30 |
+
* @param OutputInterface $output
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
protected function execute(\FcfVendor\Symfony\Component\Console\Input\InputInterface $input, \FcfVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
34 |
+
{
|
35 |
+
$numberOfJobs = (int) $input->getArgument(self::NUMBER_OF_JOBS);
|
36 |
+
$acceptanceTestsDir = \getcwd() . '/tests/codeception/tests/acceptance';
|
37 |
+
for ($i = 1; $i <= $numberOfJobs; $i++) {
|
38 |
+
$parallelDir = $acceptanceTestsDir . '/' . $i;
|
39 |
+
if (!\file_exists($parallelDir)) {
|
40 |
+
\mkdir($parallelDir);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
$currentIndex = 1;
|
44 |
+
$files = \scandir($acceptanceTestsDir);
|
45 |
+
foreach ($files as $fileName) {
|
46 |
+
$fileFullPath = $acceptanceTestsDir . '/' . $fileName;
|
47 |
+
if (!\is_dir($fileFullPath)) {
|
48 |
+
$targetPath = $acceptanceTestsDir . '/' . $currentIndex . '/' . $fileName;
|
49 |
+
\copy($fileFullPath, $targetPath);
|
50 |
+
$currentIndex++;
|
51 |
+
if ($currentIndex > $numberOfJobs) {
|
52 |
+
$currentIndex = 1;
|
53 |
+
}
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/PrepareWordpressForCodeception.php
ADDED
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FcfVendor\WPDesk\Composer\Codeception\Commands;
|
4 |
+
|
5 |
+
use FcfVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
+
use FcfVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
+
use FcfVendor\Symfony\Component\Console\Output\OutputInterface;
|
8 |
+
use FcfVendor\Symfony\Component\Yaml\Exception\ParseException;
|
9 |
+
use FcfVendor\Symfony\Component\Yaml\Yaml;
|
10 |
+
/**
|
11 |
+
* Prepare Database for Codeception tests command.
|
12 |
+
*
|
13 |
+
* @package WPDesk\Composer\Codeception\Commands
|
14 |
+
*/
|
15 |
+
class PrepareWordpressForCodeception extends \FcfVendor\WPDesk\Composer\Codeception\Commands\BaseCommand
|
16 |
+
{
|
17 |
+
use LocalCodeceptionTrait;
|
18 |
+
/**
|
19 |
+
* Configure command.
|
20 |
+
*/
|
21 |
+
protected function configure()
|
22 |
+
{
|
23 |
+
parent::configure();
|
24 |
+
$this->setName('prepare-wordpress-for-codeception')->setDescription('Prepare wordpress installation for codeception tests.');
|
25 |
+
}
|
26 |
+
/**
|
27 |
+
* Execute command.
|
28 |
+
*
|
29 |
+
* @param InputInterface $input
|
30 |
+
* @param OutputInterface $output
|
31 |
+
* @return void
|
32 |
+
*/
|
33 |
+
protected function execute(\FcfVendor\Symfony\Component\Console\Input\InputInterface $input, \FcfVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
34 |
+
{
|
35 |
+
$configuration = $this->getWpDeskConfiguration();
|
36 |
+
$this->installWP($output, $configuration);
|
37 |
+
}
|
38 |
+
/**
|
39 |
+
* @param OutputInterface $output
|
40 |
+
* @param Configuration $configuration
|
41 |
+
*/
|
42 |
+
private function installWP(\FcfVendor\Symfony\Component\Console\Output\OutputInterface $output, \FcfVendor\WPDesk\Composer\Codeception\Commands\Configuration $configuration)
|
43 |
+
{
|
44 |
+
if (!\file_exists($configuration->getApacheDocumentRoot())) {
|
45 |
+
\mkdir($configuration->getApacheDocumentRoot(), 0777, \true);
|
46 |
+
}
|
47 |
+
$dbhost = $configuration->getDbhost();
|
48 |
+
$dbname = $configuration->getDbname();
|
49 |
+
$dbuser = $configuration->getDbuser();
|
50 |
+
$dbpassword = $configuration->getDbpassword();
|
51 |
+
$url = $configuration->getWptestsIp();
|
52 |
+
$apache_document_root = $configuration->getApacheDocumentRoot();
|
53 |
+
$this->executeWpCliAndOutput('core download --force', $output, $apache_document_root);
|
54 |
+
$this->executeWpCliAndOutput("core config --dbhost={$dbhost} --dbname={$dbname} --dbuser={$dbuser} --dbpass={$dbpassword}", $output, $apache_document_root);
|
55 |
+
$this->executeWpCliAndOutput("core install --url={$url} --title=Woo-tests --admin_user=admin --admin_password=admin --admin_email=tests@wpdesk.dev --skip-email", $output, $apache_document_root);
|
56 |
+
\copy('./vendor/wpdesk/wp-codeception/wordpress/htaccess', $apache_document_root . '/.htaccess');
|
57 |
+
$this->executeWpCliAndOutput('rewrite structure \'/%postname%/\'', $output, $apache_document_root);
|
58 |
+
$this->executeWpCliAndOutput('plugin install woocommerce', $output, $apache_document_root);
|
59 |
+
$this->executeWpCliAndOutput('theme activate storefront', $output, $apache_document_root);
|
60 |
+
$this->executeWpCliAndOutput('theme delete storefront-wpdesk-tests', $output, $apache_document_root);
|
61 |
+
$this->executeWpCliAndOutput('theme install storefront', $output, $apache_document_root);
|
62 |
+
$this->executeWpCliAndOutput('theme install https://gitlab.com/wpdesk/storefront-wpdesk-tests/-/archive/master/storefront-wpdesk-tests-master.zip', $output, $apache_document_root);
|
63 |
+
\rename($apache_document_root . '/wp-content/themes/storefront-wpdesk-tests-master', $apache_document_root . '/wp-content/themes/storefront-wpdesk-tests');
|
64 |
+
$this->executeWpCliAndOutput('theme activate storefront-wpdesk-tests', $output, $apache_document_root);
|
65 |
+
}
|
66 |
+
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/RunLocalCodeceptionTests.php
CHANGED
@@ -5,6 +5,8 @@ namespace FcfVendor\WPDesk\Composer\Codeception\Commands;
|
|
5 |
use FcfVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
use FcfVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
use FcfVendor\Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
|
8 |
/**
|
9 |
* Codeception tests run command.
|
10 |
*
|
@@ -12,13 +14,14 @@ use FcfVendor\Symfony\Component\Console\Output\OutputInterface;
|
|
12 |
*/
|
13 |
class RunLocalCodeceptionTests extends \FcfVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests
|
14 |
{
|
|
|
15 |
/**
|
16 |
* Configure command.
|
17 |
*/
|
18 |
protected function configure()
|
19 |
{
|
20 |
parent::configure();
|
21 |
-
$this->setName('run-local-codeception-tests')->setDescription('Run local codeception tests.')->setDefinition(array(new \FcfVendor\Symfony\Component\Console\Input\InputArgument(self::SINGLE, \FcfVendor\Symfony\Component\Console\Input\InputArgument::OPTIONAL, 'Name of Single test to run.', ' ')
|
22 |
}
|
23 |
/**
|
24 |
* Execute command.
|
@@ -29,9 +32,14 @@ class RunLocalCodeceptionTests extends \FcfVendor\WPDesk\Composer\Codeception\Co
|
|
29 |
*/
|
30 |
protected function execute(\FcfVendor\Symfony\Component\Console\Input\InputInterface $input, \FcfVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
31 |
{
|
|
|
|
|
32 |
$singleTest = $input->getArgument(self::SINGLE);
|
33 |
-
$
|
34 |
-
$
|
|
|
|
|
|
|
35 |
$this->execAndOutput($runLocalTests, $output);
|
36 |
}
|
37 |
}
|
5 |
use FcfVendor\Symfony\Component\Console\Input\InputArgument;
|
6 |
use FcfVendor\Symfony\Component\Console\Input\InputInterface;
|
7 |
use FcfVendor\Symfony\Component\Console\Output\OutputInterface;
|
8 |
+
use FcfVendor\Symfony\Component\Yaml\Exception\ParseException;
|
9 |
+
use FcfVendor\Symfony\Component\Yaml\Yaml;
|
10 |
/**
|
11 |
* Codeception tests run command.
|
12 |
*
|
14 |
*/
|
15 |
class RunLocalCodeceptionTests extends \FcfVendor\WPDesk\Composer\Codeception\Commands\RunCodeceptionTests
|
16 |
{
|
17 |
+
use LocalCodeceptionTrait;
|
18 |
/**
|
19 |
* Configure command.
|
20 |
*/
|
21 |
protected function configure()
|
22 |
{
|
23 |
parent::configure();
|
24 |
+
$this->setName('run-local-codeception-tests')->setDescription('Run local codeception tests.')->setDefinition(array(new \FcfVendor\Symfony\Component\Console\Input\InputArgument(self::SINGLE, \FcfVendor\Symfony\Component\Console\Input\InputArgument::OPTIONAL, 'Name of Single test to run.', ' ')));
|
25 |
}
|
26 |
/**
|
27 |
* Execute command.
|
32 |
*/
|
33 |
protected function execute(\FcfVendor\Symfony\Component\Console\Input\InputInterface $input, \FcfVendor\Symfony\Component\Console\Output\OutputInterface $output)
|
34 |
{
|
35 |
+
$configuration = $this->getWpDeskConfiguration();
|
36 |
+
$this->prepareWpConfig($output, $configuration);
|
37 |
$singleTest = $input->getArgument(self::SINGLE);
|
38 |
+
$sep = \DIRECTORY_SEPARATOR;
|
39 |
+
$codecept = "vendor{$sep}bin{$sep}codecept";
|
40 |
+
$cleanOutput = $codecept . ' clean';
|
41 |
+
$this->execAndOutput($cleanOutput, $output);
|
42 |
+
$runLocalTests = $codecept . ' run -f --steps --html --verbose acceptance ' . $singleTest;
|
43 |
$this->execAndOutput($runLocalTests, $output);
|
44 |
}
|
45 |
}
|
vendor_prefixed/wpdesk/wp-codeception/src/WPDesk/Composer/Commands/SettingsException.php
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Class SettingsException
|
5 |
+
* @package WPDesk\Composer\Codeception\Commands
|
6 |
+
*/
|
7 |
+
namespace FcfVendor\WPDesk\Composer\Codeception\Commands;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Settings Exception.
|
11 |
+
*/
|
12 |
+
class SettingsException extends \RuntimeException
|
13 |
+
{
|
14 |
+
}
|
vendor_prefixed/wpdesk/wp-notice/composer.json
CHANGED
@@ -17,7 +17,7 @@
|
|
17 |
],
|
18 |
"require": {
|
19 |
"php": ">=5.5",
|
20 |
-
"wpdesk\/wp-builder": "^1.0"
|
21 |
},
|
22 |
"require-dev": {
|
23 |
"phpunit\/phpunit": "<7",
|
17 |
],
|
18 |
"require": {
|
19 |
"php": ">=5.5",
|
20 |
+
"wpdesk\/wp-builder": "^1.0|^2.0"
|
21 |
},
|
22 |
"require-dev": {
|
23 |
"phpunit\/phpunit": "<7",
|