dkdeploy-typo3-cms 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.rubocop.yml +23 -0
  4. data/.travis.yml +12 -0
  5. data/Berksfile +3 -0
  6. data/Berksfile.lock +66 -0
  7. data/CHANGELOG.md +12 -0
  8. data/CONTRIBUTORS.md +16 -0
  9. data/Gemfile +3 -0
  10. data/LICENSE +7 -0
  11. data/README.md +87 -0
  12. data/Rakefile +1 -0
  13. data/Vagrantfile +62 -0
  14. data/assets/dkdeploy-logo.png +0 -0
  15. data/config/vm/cookbooks/dkdeploy-typo3-cms/metadata.rb +12 -0
  16. data/config/vm/cookbooks/dkdeploy-typo3-cms/recipes/default.rb +71 -0
  17. data/dkdeploy-typo3-cms.gemspec +29 -0
  18. data/features/advanced_typo3.feature +156 -0
  19. data/features/caretaker_key_management.feature +36 -0
  20. data/features/clear_cache_on_rollback.feature +17 -0
  21. data/features/cli.feature +61 -0
  22. data/features/step_definitions/mysql.rb +75 -0
  23. data/features/step_definitions/typo3.rb +16 -0
  24. data/features/support/env.rb +11 -0
  25. data/features/typo3.feature +100 -0
  26. data/features/typoscript_upload_and_merge_config.feature +128 -0
  27. data/features/typoscript_upload_and_merge_pagets.feature +128 -0
  28. data/features/typoscript_upload_and_merge_userts.feature +128 -0
  29. data/features/update_database.feature +23 -0
  30. data/lib/capistrano/dkdeploy/typo3_cms.rb +37 -0
  31. data/lib/dkdeploy/typo3/cms.rb +1 -0
  32. data/lib/dkdeploy/typo3/cms/dsl.rb +27 -0
  33. data/lib/dkdeploy/typo3/cms/helpers/cli.rb +165 -0
  34. data/lib/dkdeploy/typo3/cms/helpers/erb.rb +25 -0
  35. data/lib/dkdeploy/typo3/cms/i18n.rb +111 -0
  36. data/lib/dkdeploy/typo3/cms/tasks/cache.rake +18 -0
  37. data/lib/dkdeploy/typo3/cms/tasks/caretaker_key_management.rake +60 -0
  38. data/lib/dkdeploy/typo3/cms/tasks/cli.rake +45 -0
  39. data/lib/dkdeploy/typo3/cms/tasks/typo3.rake +272 -0
  40. data/lib/dkdeploy/typo3/cms/tasks/typoscript.rake +288 -0
  41. data/lib/dkdeploy/typo3/cms/version.rb +16 -0
  42. data/spec/fixtures/application/Capfile +8 -0
  43. data/spec/fixtures/application/Gemfile +3 -0
  44. data/spec/fixtures/application/config/deploy.rb +8 -0
  45. data/spec/fixtures/application/config/deploy/dev.rb +41 -0
  46. data/spec/fixtures/application/htdocs/.hidden/.gitkeep +0 -0
  47. data/spec/fixtures/application/htdocs/catalog/index.html +1 -0
  48. data/spec/fixtures/application/htdocs/composer.json +24 -0
  49. data/spec/fixtures/application/htdocs/typo3/cli_dispatch.phpsh +2 -0
  50. data/spec/fixtures/application/htdocs/typo3conf/AdditionalConfiguration.php +3 -0
  51. data/spec/fixtures/application/htdocs/typo3conf/LocalConfiguration.php +28 -0
  52. data/spec/fixtures/application/htdocs/typo3conf/PackageStates.php +358 -0
  53. data/spec/fixtures/application/vendor/composer.phar +0 -0
  54. data/spec/fixtures/capistrano/configuration/additional_configuration_for_server.rb +1 -0
  55. data/spec/fixtures/capistrano/configuration/cli_break_after_one_run_in_release_path.rb +14 -0
  56. data/spec/fixtures/capistrano/configuration/cli_break_after_three_runs_in_release_path.rb +14 -0
  57. data/spec/fixtures/capistrano/configuration/cli_test_tasks.rb +19 -0
  58. data/spec/fixtures/capistrano/configuration/cli_test_tasks_with_path.rb +15 -0
  59. data/vendor/AdditionalConfiguration.php.erb +57 -0
  60. data/vendor/create_caretaker_instance_keys.php.erb +18 -0
  61. metadata +222 -0
@@ -0,0 +1,156 @@
1
+ Feature: Test tasks for namespace 'typo3:cms'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+ And I run `cap dev deploy`
7
+
8
+ Scenario: Generate custom ERB Template with custom name
9
+ Given I successfully run `cap dev typo3:cms:generate_additional_configuration_template['vendor/customer_specific_config.php.erb']`
10
+ Then a file named "vendor/customer_specific_config.php.erb" should exist
11
+
12
+ Scenario: Use custom ERB Template to generate "AdditionalConfiguration.php" file
13
+ Given a file named "vendor/customer_specific_config.php.erb" with:
14
+ """
15
+ <?php
16
+ <% if File.exist?(File.join('htdocs', 'typo3conf', 'AdditionalConfiguration.php')) %>
17
+ <%= sanitize_php File.read(File.join('htdocs', 'typo3conf', 'AdditionalConfiguration.php')) %>
18
+ <% end %>
19
+ $GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1;
20
+ """
21
+ When I successfully run `cap dev typo3:cms:setup_additional_configuration['vendor/customer_specific_config.php.erb']`
22
+ And the remote file "current_path/typo3conf/AdditionalConfiguration.php" should contain exactly:
23
+ """
24
+ <?php
25
+ putenv('TYPO3_DISABLE_CORE_UPDATER=1');
26
+ $GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1;
27
+ """
28
+
29
+
30
+ Scenario: Setup no stage specific configuration
31
+ Given a file named "htdocs/typo3conf/AdditionalConfiguration.php" with:
32
+ """
33
+ <?php
34
+ // I am the default AdditionalConfiguration.php.
35
+ ?>
36
+ """
37
+ When I successfully run `cap dev typo3:cms:setup_additional_configuration --trace`
38
+ Then a remote file named "current_path/typo3conf/AdditionalConfiguration.php" should exist
39
+ And the remote file "current_path/typo3conf/AdditionalConfiguration.php" should contain exactly:
40
+ """
41
+ <?php
42
+ // Content of default configuration file
43
+ // I am the default AdditionalConfiguration.php.
44
+
45
+ // Include section
46
+ """
47
+
48
+ Scenario: Setup stage specific configuration
49
+ Given a file named "htdocs/typo3conf/AdditionalConfiguration.php" with:
50
+ """
51
+ <?php
52
+ // I am the default AdditionalConfiguration.php and I shall be merged!
53
+ ?>
54
+ """
55
+ And a file named "config/typo3/AdditionalConfiguration.dev.php" with:
56
+ """
57
+
58
+ <?php
59
+ // I am AdditionalConfiguration.dev.php. I hope to survive this merge.
60
+ // Here are some additional settings
61
+ ?>
62
+ """
63
+ When I successfully run `cap dev typo3:cms:setup_additional_configuration`
64
+ Then a remote file named "current_path/typo3conf/AdditionalConfiguration.php" should exist
65
+ And the remote file "current_path/typo3conf/AdditionalConfiguration.php" should contain exactly:
66
+ """
67
+ <?php
68
+ // Content of default configuration file
69
+ // I am the default AdditionalConfiguration.php and I shall be merged!
70
+
71
+ // Content of stage configuration file
72
+ // I am AdditionalConfiguration.dev.php. I hope to survive this merge.
73
+ // Here are some additional settings
74
+
75
+ // Include section
76
+ """
77
+
78
+ Scenario: Extend file "AdditionalConfiguration" with content from extra configuration files
79
+ Given a file named "config/typo3/ExtraConfiguration.php" with:
80
+ """
81
+ <?php
82
+ $GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1;
83
+ """
84
+ And I extend the development capistrano configuration variable additional_configuration_files with value ['config/typo3/ExtraConfiguration.php']
85
+ When I successfully run `cap dev typo3:cms:setup_additional_configuration`
86
+ Then a remote file named "current_path/typo3conf/AdditionalConfiguration.php" should exist
87
+ And the remote file "current_path/typo3conf/AdditionalConfiguration.php" should contain exactly:
88
+ """
89
+ <?php
90
+ // Content of default configuration file
91
+ putenv('TYPO3_DISABLE_CORE_UPDATER=1');
92
+
93
+ // Content of additional configuration file "ExtraConfiguration.php"
94
+ $GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1;
95
+
96
+ // Include section
97
+ """
98
+
99
+ Scenario: Extend file "AdditionalConfiguration" with content from extra ruby template configuration files
100
+ Given a file named "config/typo3/ExtraConfiguration.php.erb" with:
101
+ """
102
+ <?php
103
+ $extraConfiguration = '<%= server %>';
104
+ """
105
+ And I extend the development capistrano configuration variable additional_configuration_files with value ['config/typo3/ExtraConfiguration.php.erb']
106
+ When I successfully run `cap dev typo3:cms:setup_additional_configuration`
107
+ Then a remote file named "current_path/typo3conf/AdditionalConfiguration.php" should exist
108
+ And the remote file "current_path/typo3conf/AdditionalConfiguration.php" should contain exactly:
109
+ """
110
+ <?php
111
+ // Content of default configuration file
112
+ putenv('TYPO3_DISABLE_CORE_UPDATER=1');
113
+
114
+ // Content of additional configuration file "ExtraConfiguration.php.erb"
115
+ $extraConfiguration = 'dkdeploy-typo3-cms.dev';
116
+
117
+ // Include section
118
+ """
119
+
120
+ Scenario: Extend file "AdditionalConfiguration" with content from server configuration files
121
+ Given a file named "config/typo3/ServerConfiguration.php" with:
122
+ """
123
+ <?php
124
+ $GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1;
125
+ """
126
+ And I extend the development capistrano configuration from the fixture file additional_configuration_for_server.rb
127
+ When I successfully run `cap dev typo3:cms:setup_additional_configuration`
128
+ Then a remote file named "current_path/typo3conf/AdditionalConfiguration.php" should exist
129
+ And the remote file "current_path/typo3conf/AdditionalConfiguration.php" should contain exactly:
130
+ """
131
+ <?php
132
+ // Content of default configuration file
133
+ putenv('TYPO3_DISABLE_CORE_UPDATER=1');
134
+
135
+ // Content of server "dkdeploy-typo3-cms.dev" configuration file "ServerConfiguration.php"
136
+ $GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1;
137
+
138
+ // Include section
139
+ """
140
+
141
+ Scenario: Task "typo3:cms:remove_extensions" does not remove extension directory
142
+ Given a successfully deployed TYPO3 application
143
+ When I successfully run `cap dev typo3:cms:remove_extensions`
144
+ Then a remote directory named "current_path/typo3conf/ext/realurl" should exist
145
+
146
+ Scenario: Task "typo3:cms:remove_extensions" does remove extension directory
147
+ Given a successfully deployed TYPO3 application
148
+ And a remote directory named "current_path/typo3conf/ext/test_extension"
149
+ When I successfully run `cap dev typo3:cms:remove_extensions`
150
+ Then a remote directory named "current_path/typo3conf/ext/test_extension" should not exist
151
+
152
+ Scenario: Task "typo3:cms:create_extension_folders" create needed directories
153
+ Given a successfully deployed TYPO3 application
154
+ And a remote directory named "current_path/uploads/tx_realurl" should not exist
155
+ When I successfully run `cap dev typo3:cms:fix_folder_structure`
156
+ Then a remote directory named "current_path/uploads/tx_realurl" should exist
@@ -0,0 +1,36 @@
1
+ Feature: Test tasks in namespace 'caretaker'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+
7
+ Scenario: Testing creation of keys
8
+ When I successfully run `cap dev caretaker:create_keys`
9
+ Then a remote file named "shared_path/config/privkey.pem" should exist
10
+ And a remote file named "shared_path/config/pubkey.pem" should exist
11
+ And a remote file named "caretaker_instance_keys.php" should not exist
12
+
13
+ Scenario: Testing forceful creation of keys
14
+ When I successfully run `cap dev "caretaker:create_keys[yes]"`
15
+ Then a remote file named "shared_path/config/privkey.pem" should exist
16
+ And a remote file named "shared_path/config/pubkey.pem" should exist
17
+ And a remote file named "caretaker_instance_keys.php" should not exist
18
+
19
+ Scenario: Testing display of keys
20
+ Given I successfully run `cap dev "caretaker:create_keys"`
21
+ When I successfully run `cap dev "caretaker:show_public_key"`
22
+ And the output should contain "Output file /var/www/dkdeploy/shared/config/pubkey.pem (dkdeploy-typo3-cms.dev):"
23
+ Then the output should match:
24
+ """
25
+ -----BEGIN PUBLIC KEY-----
26
+ .*
27
+ -----END PUBLIC KEY-----
28
+ """
29
+ And the output should contain:
30
+ """
31
+ One line public key (dkdeploy-typo3-cms.dev):
32
+ """
33
+ And the output should match:
34
+ """
35
+ -----BEGIN PUBLIC KEY-----.*-----END PUBLIC KEY-----
36
+ """
@@ -0,0 +1,17 @@
1
+ Feature: Clearing file cache when deployment fails
2
+ Background:
3
+ Given a test app with the default configuration
4
+ And the remote server is cleared
5
+ And I run `cap dev deploy`
6
+
7
+
8
+ Scenario: When deployment fails after symlinking the new release
9
+ Given a remote directory named "current_path/typo3temp/Cache"
10
+ And a remote file named "current_path/typo3temp/Cache/test_cache_file" with:
11
+ """
12
+ cached content
13
+ """
14
+ And I provoke an exception for testing purposes after symlinking the new release
15
+ When I run `cap dev deploy`
16
+ And the exit status should not be 0
17
+ And a remote file named "current_path/typo3temp/Cache/test_cache_file" should not exist
@@ -0,0 +1,61 @@
1
+ Feature: Test tasks for namespace 'typo3:cms:cli:run'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+ And the project is deployed
7
+
8
+ Scenario: Running one time
9
+ And I extend the development capistrano configuration from the fixture file cli_test_tasks.rb
10
+ When I successfully run `cap dev typo3:cms:cli:break_after_one_run`
11
+ Then the output should contain "Running cli task for the 1. time"
12
+ And the output should not contain "Running cli task for the 2. time"
13
+ And the output should contain "Breaking loop after 1 run because block yields false"
14
+
15
+ Scenario: Running several times
16
+ And I extend the development capistrano configuration from the fixture file cli_test_tasks.rb
17
+ When I successfully run `cap dev typo3:cms:cli:break_after_three_runs`
18
+ Then the output should contain "Running cli task for the 1. time"
19
+ And the output should contain "Running cli task for the 2. time"
20
+ And the output should contain "Running cli task for the 3. time"
21
+ And the output should contain "Maximum number of cli calls reached!"
22
+ And the output should not contain "Breaking loop after 1 run because block yields false"
23
+ And the output should not contain "Breaking loop after 2 run because block yields false"
24
+ And the output should not contain "Breaking loop after 3 run because block yields false"
25
+
26
+ Scenario: Running one time in release path
27
+ And I extend the development capistrano configuration from the fixture file cli_break_after_one_run_in_release_path.rb
28
+ When I successfully run `cap dev deploy`
29
+ Then the output should contain "Running cli task for the 1. time"
30
+ And the output should not contain "Running cli task for the 2. time"
31
+ And the output should contain "Breaking loop after 1 run because block yields false"
32
+
33
+ Scenario: Running several times in release path
34
+ And I extend the development capistrano configuration from the fixture file cli_break_after_three_runs_in_release_path.rb
35
+ When I successfully run `cap dev deploy`
36
+ Then the output should contain "Running cli task for the 1. time"
37
+ And the output should contain "Running cli task for the 2. time"
38
+ And the output should contain "Running cli task for the 3. time"
39
+ And the output should contain "Maximum number of cli calls reached!"
40
+ And the output should not contain "Breaking loop after 1 run because block yields false"
41
+ And the output should not contain "Breaking loop after 2 run because block yields false"
42
+ And the output should not contain "Breaking loop after 3 run because block yields false"
43
+
44
+ Scenario: Checking injected environment variables
45
+ When I successfully run `cap dev typo3:cms:cli:run`
46
+ Then the output should contain "TYPO3_COMPOSER_AUTOLOAD=1"
47
+
48
+ Scenario: Checking injected environment variables in release path
49
+ And I extend the development capistrano configuration from the fixture file cli_test_tasks_with_path.rb
50
+ When I successfully run `cap dev deploy`
51
+ # Here in the regex string "any character" is used to match the slashes. Every attempt to use the directory slashes failed for unknown reasons
52
+ Then the output should match /.var.www.dkdeploy.releases.\d{4}-\d{2}-\d{2}-\d{2}-\d{2}-\d{2}.typo3.cli_dispatch\.phpsh/
53
+ And the output should contain "TYPO3_COMPOSER_AUTOLOAD=1"
54
+
55
+ Scenario: Checking injected environment variables
56
+ When I successfully run `cap dev typo3:cms:cli:upload_wrapper`
57
+ Then the remote file "current_path/typo3_cms_cli_dispatch.sh" should contain exactly:
58
+ """
59
+ #!/usr/bin/env bash
60
+ TYPO3_COMPOSER_AUTOLOAD='1' TERM='screen-256color' /usr/bin/env php /var/www/dkdeploy/current/typo3/cli_dispatch.phpsh $@
61
+ """
@@ -0,0 +1,75 @@
1
+ Given(/^the TYPO3 table be_users exists$/) do # rubocop:disable Metrics/BlockLength
2
+ mysql_client = instantiate_mysql_client @database_name
3
+ mysql_client.query 'DROP TABLE IF EXISTS be_users;'
4
+ mysql_client.query "CREATE TABLE be_users (
5
+ uid int(11) unsigned NOT NULL auto_increment,
6
+ pid int(11) unsigned DEFAULT '0' NOT NULL,
7
+ tstamp int(11) unsigned DEFAULT '0' NOT NULL,
8
+ username varchar(50) DEFAULT '' NOT NULL,
9
+ password varchar(100) DEFAULT '' NOT NULL,
10
+ admin tinyint(4) unsigned DEFAULT '0' NOT NULL,
11
+ usergroup varchar(255) DEFAULT '' NOT NULL,
12
+ disable tinyint(1) unsigned DEFAULT '0' NOT NULL,
13
+ starttime int(11) unsigned DEFAULT '0' NOT NULL,
14
+ endtime int(11) unsigned DEFAULT '0' NOT NULL,
15
+ lang char(2) DEFAULT '' NOT NULL,
16
+ email varchar(80) DEFAULT '' NOT NULL,
17
+ db_mountpoints text,
18
+ options tinyint(4) unsigned DEFAULT '0' NOT NULL,
19
+ crdate int(11) unsigned DEFAULT '0' NOT NULL,
20
+ cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
21
+ realName varchar(80) DEFAULT '' NOT NULL,
22
+ userMods text,
23
+ allowed_languages varchar(255) DEFAULT '' NOT NULL,
24
+ uc mediumtext,
25
+ file_mountpoints text,
26
+ file_permissions text,
27
+ workspace_perms tinyint(3) DEFAULT '1' NOT NULL,
28
+ lockToDomain varchar(50) DEFAULT '' NOT NULL,
29
+ disableIPlock tinyint(1) unsigned DEFAULT '0' NOT NULL,
30
+ deleted tinyint(1) unsigned DEFAULT '0' NOT NULL,
31
+ TSconfig text,
32
+ lastlogin int(10) unsigned DEFAULT '0' NOT NULL,
33
+ createdByAction int(11) DEFAULT '0' NOT NULL,
34
+ usergroup_cached_list text,
35
+ workspace_id int(11) DEFAULT '0' NOT NULL,
36
+ workspace_preview tinyint(3) DEFAULT '1' NOT NULL,
37
+ category_perms varchar(255) DEFAULT '' NOT NULL,
38
+ PRIMARY KEY (uid),
39
+ KEY parent (pid),
40
+ KEY username (username)
41
+ );"
42
+ end
43
+
44
+ # From TYPO3 CMS V6 Gem:
45
+ Given(/a TYPO3 backend user "(.*)" exists$/) do |username|
46
+ mysql_client = instantiate_mysql_client @database_name
47
+ mysql_client.query "INSERT INTO `be_users` (username, admin, crdate, tstamp)
48
+ VALUES
49
+ ('#{mysql_client.escape(username)}', 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP());"
50
+ end
51
+
52
+ Given(/^the database table `(.*)` exists$/) do |table|
53
+ mysql_client = instantiate_mysql_client @database_name
54
+ mysql_client.query "DROP Table IF EXISTS #{mysql_client.escape(table)};"
55
+ mysql_client.query "CREATE TABLE #{mysql_client.escape(table)} (
56
+ uid INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY
57
+ );"
58
+ end
59
+
60
+ Given(/^drop the database table `(.*)`/) do |table|
61
+ mysql_client = instantiate_mysql_client @database_name
62
+ mysql_client.query "DROP Table #{mysql_client.escape(table)};"
63
+ end
64
+
65
+ Then(/^the database (should|should not) have a table `(.*)`$/) do |should_or_not, table|
66
+ mysql_client = instantiate_mysql_client
67
+ query_string = "SELECT `TABLE_NAME`
68
+ FROM `information_schema`.`TABLES`
69
+ WHERE `TABLE_SCHEMA` = '#{mysql_client.escape(@database_name)}'
70
+ AND `TABLE_NAME` = '#{mysql_client.escape(table)}';"
71
+ results = mysql_client.query query_string
72
+ number_of_columns = results.count
73
+ expectation = should_or_not == 'should' ? 1 : 0
74
+ expect(number_of_columns).to eq expectation
75
+ end
@@ -0,0 +1,16 @@
1
+ Given(/^a successfully deployed TYPO3 application$/) do
2
+ step 'I want to use the database `dkdeploy_typo3_cms`'
3
+ step 'the TYPO3 table be_users exists'
4
+ step 'a TYPO3 backend user "_cli_lowlevel" exists'
5
+ step 'I successfully run `cap dev composer:local:run[install]` for up to 60 seconds'
6
+ step 'I successfully run `cap dev db:upload_settings[127.0.0.1,3306,dkdeploy_typo3_cms,root,ilikerandompasswords,utf8]`'
7
+ step 'I successfully run `cap dev typo3:cms:create_db_credentials`'
8
+ step 'I successfully run `cap dev typo3:cms:create_install_tool_password_file[dkdeploy]`'
9
+ step 'I successfully run `cap dev typo3:cms:create_encryption_key_file[ca01b5b9868677647d3ec6c91b6b338a34786d6d4e163fb44badde98d11c9f887a5567a1d7797847de011693c36e110f]`'
10
+ step 'I successfully run `cap dev deploy`'
11
+ step 'I successfully run `cap dev typo3:cms:setup_additional_configuration`'
12
+ step 'I successfully run `cap dev typo3:cms:update_database`'
13
+ step 'I successfully run `cap dev file_access:set_permissions_of_release_path`'
14
+ step 'I successfully run `cap dev file_access:set_permissions_of_shared_path`'
15
+ step 'I successfully run `cap dev file_access:set_custom_access`'
16
+ end
@@ -0,0 +1,11 @@
1
+ require 'dkdeploy/test_environment/application'
2
+ ssh_config = {}
3
+
4
+ ssh_key_files = Dir.glob(File.join(Dir.getwd, '.vagrant', 'machines', '**', 'virtualbox', 'private_key'))
5
+ unless ssh_key_files.empty?
6
+ # Define generated ssh key files
7
+ ssh_config = { user: 'vagrant', keys: ssh_key_files }
8
+ end
9
+
10
+ TEST_APPLICATION = Dkdeploy::TestEnvironment::Application.new(File.expand_path('../../../', __FILE__), 'dkdeploy-typo3-cms.dev', ssh_config)
11
+ TEST_APPLICATION.mysql_connection_settings = { host: 'dkdeploy-typo3-cms.dev', username: 'root', password: 'ilikerandompasswords' }
@@ -0,0 +1,100 @@
1
+ Feature: Test tasks for namespace 'typo3:cms'
2
+
3
+ Background:
4
+ Given a test app with the default configuration
5
+ And the remote server is cleared
6
+
7
+ Scenario: Toggle TYPO3 Install Tool
8
+ When I successfully run `cap dev typo3:cms:enable_install_tool`
9
+ Then a remote file named "current_path/typo3conf/ENABLE_INSTALL_TOOL" should exist
10
+ When I successfully run `cap dev typo3:cms:disable_install_tool`
11
+ Then a remote file named "current_path/typo3conf/ENABLE_INSTALL_TOOL" should not exist
12
+
13
+ Scenario: Clear typo3temp
14
+ Given a remote empty file named "release_path/typo3temp/testdirectory/file.png"
15
+ When I successfully run `cap dev typo3:cms:clear_typo3temp`
16
+ Then a remote directory named "current_path/typo3temp/testdirectory" should not exist
17
+ And a remote file named "current_path/typo3temp/testdirectory/file.png" should not exist
18
+
19
+ Scenario: Fetch extension if it exists
20
+ And the project is deployed
21
+ Given a remote empty file named "current_path/typo3conf/ext/demo/extension.php"
22
+ And a remote directory named "current_path/typo3conf/ext/demo/.git/gitRemote"
23
+ And a remote directory named "current_path/typo3conf/ext/demo/.svn/svnRemote"
24
+ And an empty file named "htdocs/typo3conf/ext/demo/toBeDeleted.php"
25
+ And an empty file named "htdocs/typo3conf/ext/demo/.git/gitOriginal"
26
+ And an empty file named "htdocs/typo3conf/ext/demo/.svn/svnOriginal"
27
+ When I run `cap dev typo3:cms:fetch_extension` interactively
28
+ And I type "demo"
29
+ And I close the stdin stream
30
+ Then the exit status should be 0
31
+ When I wait 5 seconds to let the filesystem write the changes to disk
32
+ Then a file named "htdocs/typo3conf/ext/demo/extension.php" should exist
33
+ And a file named "htdocs/typo3conf/ext/demo/toBeDeleted.php" should not exist
34
+ And a file named "htdocs/typo3conf/ext/demo/.git/gitOriginal" should exist
35
+ And a file named "htdocs/typo3conf/ext/demo/.git/gitRemote" should not exist
36
+ And a file named "htdocs/typo3conf/ext/demo/.svn/svnOriginal" should exist
37
+ And a file named "htdocs/typo3conf/ext/demo/.svn/svnRemote" should not exist
38
+
39
+ Scenario: Fetch extension if it does not exist
40
+ Given a remote empty file named "current_path/typo3conf/ext/demo/extension.php"
41
+ Then a remote file named "current_path/typo3conf/ext/demo/extension.php" should exist
42
+ When I run `cap dev typo3:cms:fetch_extension` interactively
43
+ And I type "cowabonga"
44
+ And I close the stdin stream
45
+ Then the output should contain "Extension 'cowabonga' not found!"
46
+
47
+ Scenario: Check creation of TYPO3 database config file
48
+ Given I want to use the database `dkdeploy_typo3_cms`
49
+ When I successfully run `cap dev "db:upload_settings[127.0.0.1,3306,dkdeploy,root,ilikerandompasswords,utf8]"`
50
+ When I successfully run `cap dev typo3:cms:create_db_credentials`
51
+ Then a remote file named "shared_path/config/db_settings.dev.php" should exist
52
+
53
+ Scenario: Check creation of TYPO3 database config file even if remote database config does not exist
54
+ Given I want to use the database `dkdeploy_typo3_cms`
55
+ Then a remote file named "shared_path/config/db_settings.dev.php" should not exist
56
+ When I run `cap dev typo3:cms:create_db_credentials` interactively
57
+ And I type "127.0.0.1"
58
+ And I type "3306"
59
+ And I type "dkdeploy_typo3_cms"
60
+ And I type "root"
61
+ And I type "ilikerandompasswords"
62
+ And I type "utf8"
63
+ And I close the stdin stream
64
+ Then the exit status should be 0
65
+ Then a remote file named "shared_path/config/db_settings.dev.php" should exist
66
+
67
+ Scenario: Check generation of encryption key
68
+ When I successfully run `cap dev typo3:cms:generate_encryption_key`
69
+ Then the output should match /[0-9a-fA-F]{80}/
70
+
71
+ Scenario: Check creation of encryption key file on server
72
+ When I successfully run `cap dev "typo3:cms:create_encryption_key_file[my-encryption-key]"`
73
+ Then the remote file "shared_path/config/encryption_key.php" should contain exactly:
74
+ """
75
+ <?php $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'] = 'my-encryption-key';
76
+ """
77
+
78
+ Scenario: Check creation of TYPO3 Install Tool password
79
+ When I successfully run `cap dev "typo3:cms:create_install_tool_password_file[super-secret-password]"`
80
+ Then a remote file named "shared_path/config/install_tool_password.php" should exist
81
+
82
+ Scenario: Check adding a TYPO3 admin user
83
+ Given I want to use the database `dkdeploy_typo3_cms`
84
+ Given the TYPO3 table be_users exists
85
+ When I run `cap dev typo3:cms:create_db_credentials` interactively
86
+ And I type "127.0.0.1"
87
+ And I type "3306"
88
+ And I type "dkdeploy_typo3_cms"
89
+ And I type "root"
90
+ And I type "ilikerandompasswords"
91
+ And I type "utf8"
92
+ And I close the stdin stream
93
+ Then the exit status should be 0
94
+ When I run `cap dev typo3:cms:add_admin_user` interactively
95
+ And I type "admin"
96
+ And I type "secret-password"
97
+ And I close the stdin stream
98
+ And I wait 10 second to let the database commit the transaction
99
+ Then the database should have a value `admin` in table `be_users` for column `username`
100
+ Then the database should have a value `2304d4770a72d09106045fea654c4188` in table `be_users` for column `password`