Skip to content

Commit 37dd203

Browse files
authored
drupal8 test fixes and improvements (GoogleCloudPlatform#333)
1 parent 0ddcbd5 commit 37dd203

File tree

3 files changed

+23
-34
lines changed

3 files changed

+23
-34
lines changed

appengine/flexible/drupal8/README.md

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ cd /path/to/drupal
3232
/path/to/drush dl drupal
3333
```
3434

35-
Alternatively, you can download a compressed file of Druapl 8 from the [Drupal Website][5].
35+
Alternatively, you can download a compressed file of Drupal 8 from the [Drupal Website][5].
3636

3737
### Installation
3838

@@ -59,24 +59,16 @@ Alternatively, you can download a compressed file of Druapl 8 from the [Drupal W
5959
You will want to use the Cloud SQL credentials you created in the **Prerequisites** section as your
6060
Drupal backend.
6161

62-
## Copy over App Engine files
62+
## Add app.yaml
6363

64-
For your app to deploy on App Engine Flexible, you will need to copy over the files in this
65-
directory:
64+
Add a file `app.yaml` with the following contents to the root of your Drupal project:
6665

67-
```sh
68-
# clone this repo somewhere
69-
git clone https://github.com/GoogleCloudPlatform/php-docs-samples /path/to/php-docs-samples
70-
cd /path/to/php-docs-samples/
71-
72-
# copy the two files below to the root directory of your Drupal project
73-
cp appengine/flexible/drupal8/{app.yaml,php.ini} /path/to/drupal
66+
```yaml
67+
runtime: php
68+
env: flex
7469
```
7570
76-
The two files needed are as follows:
77-
78-
1. [`app.yaml`](app.yaml) - The App Engine configuration for your project
79-
1. [`php.ini`](php.ini) - Optional ini used to extend the runtime configuration.
71+
`app.yaml` is the App Engine configuration for your project.
8072

8173
## Disable CSS and JS Cache
8274

appengine/flexible/drupal8/php.ini

Lines changed: 0 additions & 6 deletions
This file was deleted.

appengine/flexible/drupal8/test/DeployTest.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,21 @@ public static function beforeDeploy()
3939
// download, install, and deploy
4040
$tmpDir = sys_get_temp_dir() . '/test-' . FileUtil::randomName(8);
4141
self::downloadAndInstallDrupal($tmpDir);
42+
43+
// set the directory in gcloud
44+
self::$gcloudWrapper->setDir($tmpDir);
4245
}
4346

4447
private static function verifyEnvironmentVariables()
4548
{
4649
$envVars = [
4750
'GOOGLE_PROJECT_ID',
48-
'DRUPAL_ADMIN_USERNAME',
49-
'DRUPAL_ADMIN_PASSWORD',
50-
'DRUPAL_DATABASE_HOST',
51-
'DRUPAL_DATABASE_NAME',
52-
'DRUPAL_DATABASE_USER',
53-
'DRUPAL_DATABASE_PASS',
51+
'DRUPAL8_ADMIN_USERNAME',
52+
'DRUPAL8_ADMIN_PASSWORD',
53+
'DRUPAL8_DATABASE_HOST',
54+
'DRUPAL8_DATABASE_NAME',
55+
'DRUPAL8_DATABASE_USER',
56+
'DRUPAL8_DATABASE_PASS',
5457
];
5558
foreach ($envVars as $envVar) {
5659
if (false === getenv($envVar)) {
@@ -64,10 +67,10 @@ private static function downloadAndInstallDrupal($targetDir)
6467
$console = __DIR__ . '/../vendor/bin/drush';
6568

6669
$dbUrl = sprintf('mysql://%s:%s@%s/%s',
67-
getenv('DRUPAL_DATABASE_USER'),
68-
getenv('DRUPAL_DATABASE_PASS'),
69-
getenv('DRUPAL_DATABASE_HOST'),
70-
getenv('DRUPAL_DATABASE_NAME')
70+
getenv('DRUPAL8_DATABASE_USER'),
71+
getenv('DRUPAL8_DATABASE_PASS'),
72+
getenv('DRUPAL8_DATABASE_HOST'),
73+
getenv('DRUPAL8_DATABASE_NAME')
7174
);
7275

7376
// download
@@ -83,8 +86,8 @@ private static function downloadAndInstallDrupal($targetDir)
8386
'--db-url=%s --account-name=%s --account-pass=%s -y',
8487
$console,
8588
$dbUrl,
86-
getenv('DRUPAL_ADMIN_USERNAME'),
87-
getenv('DRUPAL_ADMIN_PASSWORD'));
89+
getenv('DRUPAL8_ADMIN_USERNAME'),
90+
getenv('DRUPAL8_ADMIN_PASSWORD'));
8891
$process = self::createProcess($installCmd);
8992
$process->setTimeout(null);
9093
self::executeProcess($process);
@@ -94,7 +97,7 @@ private static function downloadAndInstallDrupal($targetDir)
9497
self::execute('rm composer.*');
9598

9699
// move the code for the sample to the new drupal installation
97-
$files = ['app.yaml', 'php.ini'];
100+
$files = ['app.yaml'];
98101
foreach ($files as $file) {
99102
$source = sprintf('%s/../%s', __DIR__, $file);
100103
$target = sprintf('%s/%s', $targetDir, $file);

0 commit comments

Comments
 (0)