diff --git a/.gitignore b/.gitignore index cf18fe4b20..d2df06b183 100644 --- a/.gitignore +++ b/.gitignore @@ -1,21 +1,10 @@ # Ignore directories generated by Composer /drush/contrib/ /vendor/ -/web/core/ -/web/modules/contrib/ -/web/themes/contrib/ -/web/profiles/contrib/ -/web/libraries/ - -# Ignore sensitive information -/web/sites/*/settings.php -/web/sites/*/settings.local.php - -# Ignore Drupal's file directory -/web/sites/*/files/ - -# Ignore SimpleTest multi-site environment. -/web/sites/simpletest +/web/ # Ignore files generated by PhpStorm /.idea/ + +# Ignore files generated by phpunit +phpunit.report* diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000000..0e5e86226c --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,30 @@ +filter: + excluded_paths: + - web/* # Drupal + - modules/*/tests/* # Unit tests + - drush/contrib/* # Drush contrib + +build: + dependencies: + before: + - mysql -u root --execute "CREATE DATABASE simpletest;" + environment: + php: + version: "7.0" + variables: + SIMPLETEST_DB: mysql://root@localhost/simpletest + SIMPLETEST_BASE_URL: http://local.dev + apache2: + modules: ['rewrite'] + sites: + symfony_app: + web_root: 'web/' + host: 'local.dev' + tests: + override: + - + command: ./vendor/bin/phpunit --testsuite my-drupal-project-name + idle_timeout: 600 + coverage: + file: phpunit.report.coverage.xml + format: clover diff --git a/composer.json b/composer.json index 28023b44a4..bd24f3bd4e 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "cweagans/composer-patches": "^1.6", "drupal-composer/drupal-scaffold": "^2.2", "drupal/console": "~1.0", - "drupal/core": "~8.0", + "drupal/core": "~8.5", "drush/drush": "~8.0", "webflo/drupal-finder": "^0.3.0", "webmozart/path-util": "^2.3" @@ -28,6 +28,7 @@ "require-dev": { "behat/mink": "~1.7", "behat/mink-goutte-driver": "~1.2", + "drupal/devel": "^1.0@RC", "jcalderonzumba/gastonjs": "~1.0.2", "jcalderonzumba/mink-phantomjs-driver": "~0.3.1", "mikey179/vfsstream": "~1.2", @@ -49,6 +50,7 @@ }, "scripts": { "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold", + "create-project-symlinks": "DrupalProject\\composer\\ScriptHandler::createProjectSymlinks", "pre-install-cmd": [ "DrupalProject\\composer\\ScriptHandler::checkComposerVersion" ], @@ -56,10 +58,13 @@ "DrupalProject\\composer\\ScriptHandler::checkComposerVersion" ], "post-install-cmd": [ - "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" + "DrupalProject\\composer\\ScriptHandler::createRequiredFiles", + "DrupalProject\\composer\\ScriptHandler::createProjectSymlinks", + "DrupalComposer\\DrupalScaffold\\Plugin::scaffold" ], "post-update-cmd": [ - "DrupalProject\\composer\\ScriptHandler::createRequiredFiles" + "DrupalProject\\composer\\ScriptHandler::createRequiredFiles", + "DrupalProject\\composer\\ScriptHandler::createProjectSymlinks" ] }, "extra": { diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..86feef8cc9 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,23 @@ +mysql: + image: mysql + environment: + MYSQL_DATABASE: drupal + MYSQL_ALLOW_EMPTY_PASSWORD: 1 + ports: + - "3306:3306" + +drupal: + image: phayes/ubuntu-drupal-dev + volumes: + - .:/var/www + ports: + - "80:80" + links: + - mysql + environment: + DB_DATABASE: drupal + DB_USER: root + DB_HOST: mysql + DB_PORT: 3306 + SIMPLETEST_BASE_URL: 'http://localhost' + SIMPLETEST_DB: mysql://root@mysql/drupal diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000000..bb6d625828 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + ./web/core/tests/TestSuites/UnitTestSuite.php + + + ./web/core/tests/TestSuites/KernelTestSuite.php + + + ./web/core/tests/TestSuites/FunctionalTestSuite.php + + + ./web/core/tests/TestSuites/FunctionalJavascriptTestSuite.php + + + + + + + + + + ./modules + ./themes + ./profiles + + + ./ + ./ + + + + + + + diff --git a/phpunit.xml.dist b/phpunit.xml.dist deleted file mode 100644 index ce29746d7c..0000000000 --- a/phpunit.xml.dist +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - ./test/ - - - diff --git a/scripts/composer/ScriptHandler.php b/scripts/composer/ScriptHandler.php index a75e4d34ee..b86d4102b3 100644 --- a/scripts/composer/ScriptHandler.php +++ b/scripts/composer/ScriptHandler.php @@ -72,7 +72,7 @@ public static function createRequiredFiles(Event $event) { * installation after going through the lengthy process of compiling and * downloading the Composer dependencies. * - * @see https://github.com/composer/composer/pull/5035 + * @link https://github.com/composer/composer/pull/5035 */ public static function checkComposerVersion(Event $event) { $composer = $event->getComposer(); @@ -97,4 +97,37 @@ public static function checkComposerVersion(Event $event) { } } + /** + * If the repostory contains 'modules', 'themes', or 'profiles' directories, + * then link them into the correct place in the web directory. + */ + public static function createProjectSymlinks(Event $event) { + $fs = new Filesystem(); + $drupalFinder = new DrupalFinder(); + $drupalFinder->locateRoot(getcwd()); + $drupalRoot = $drupalFinder->getDrupalRoot(); + + $dirs = [ + 'modules', + 'profiles', + 'themes', + ]; + + foreach ($dirs as $dir) { + if ($fs->exists($dir)) { + $contents = scandir($dir); + foreach ($contents as $content) { + if ($content != '.' && $content != '..') { + $link = $drupalRoot . '/' . $dir . '/' . $content; + $target = '../../' . $dir . '/' . $content; + if (!$fs->exists($link)) { + $fs->symlink($target, $link, true); + $event->getIO()->write("Create a symlink from $link to $target"); + } + } + } + } + } + } + }