Commit ff73f34c authored by Lucas Hedding's avatar Lucas Hedding
Browse files

update to spoons 2.0

parent 5f64cf0c
......@@ -10,3 +10,7 @@ yarn.lock
#PHPUnit output
junit.xml
.phpunit.result.cache
/composer.spoons.json
/composer.spoons.lock
/.env
.envrc
include:
- project: 'drupalspoons/webmasters'
- project: 'drupalspoons/composer-plugin'
# Best practice is to pin to a tag or a SHA1. https://docs.gitlab.com/ee/ci/yaml/#includefile
ref: 1.7.0-rc1
ref: "2.1.0"
# The template below may be inspected at https://gitlab.com/drupalspoons/composer-plugin/-/blob/master/templates/.gitlab-ci.yml
file: 'templates/.gitlab-ci.yml'
# Run tests on Drupal 9.1 by default, including a phpspec/prophecy-phpunit requirement.
composer_node:
variables:
# https://getcomposer.org/doc/articles/versions.md#next-significant-release-operators
DRUPAL_CORE_CONSTRAINT: ~9.1.0
after_script:
# See https://www.drupal.org/project/drupal/issues/3182653
# This will fail on PHPUnit 8-, that is OK as its not needed there.
- vendor/bin/spoon require --no-progress phpspec/prophecy-phpunit:^2 || true
phpcs:
allow_failure: false
<?php
namespace Spoons;
use Composer\Script\Event;
use Symfony\Component\Process\Process;
/**
* A Composer script handler.
*/
class ScriptHandler {
/**
* Create a web/modules/[SLUG] dir and symlink all project files into it.
*
* @param \Composer\Script\Event $event
* A Composer package event.
*/
public static function createSymlinks(Event $event) {
$full_name = $event->getComposer()->getPackage()->getName();
[, $project_name] = explode('/', $full_name);
$cmd = "rm -rf web/modules/custom/$project_name && mkdir -p web/modules/custom/$project_name";
$process = new Process($cmd);
$process->mustRun();
$cmd = 'find ../../../.. -maxdepth 1 ! -name .git ! -name web ! -name vendor ! -name .idea -print | while read file; do ln -s "$file" .; done';
$process = new Process($cmd, "web/modules/custom/$project_name");
$process->mustRun();
}
}
......@@ -21,68 +21,26 @@
"slack": "#migrate",
"source": "https://git.drupalcode.org/project/migrate_plus"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"suggest": {
"sainsburys/guzzle-oauth2-plugin": "3.0 required for the OAuth2 authentication plugin",
"ext-soap": "*"
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
"preferred-install": "dist"
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"composer/installers": "^1",
"drupal/core-composer-scaffold": "^8.7 || ^9.0",
"cweagans/composer-patches": "~1.0",
"drupal/core-recommended": "^8.7 || ^9.0",
"drupal/core-dev": "^8.7 || ^9.0",
"drush/drush": "^10",
"mglaman/phpstan-drupal": "^0.12",
"phpstan/phpstan-deprecation-rules": "^0.12",
"php-parallel-lint/php-parallel-lint": "^1.2",
"zaporylie/composer-drupal-optimizations": "^1.0"
},
"config": {
"preferred-install": "dist",
"process-timeout": 36000
},
"autoload": {
"classmap": [".spoons/ScriptHandler.php"]
},
"scripts": {
"si": "drush si -v --db-url=sqlite://sites/default/files/.sqlite testing",
"phpcs": "phpcs --runtime-set ignore_warnings_on_exit 1 --runtime-set ignore_errors_on_exit 1 web/modules/custom",
"phpcbf": "phpcbf --runtime-set ignore_warnings_on_exit 1 --runtime-set ignore_errors_on_exit 1 web/modules/custom",
"lint": "parallel-lint --exclude web --exclude vendor .",
"webserver": "cd web && php -S 0.0.0.0:8888 .ht.router.php",
"chromedriver": "chromedriver --port=9515 --verbose --whitelisted-ips --log-path=/tmp/chromedriver.log --no-sandbox",
"unit": "phpunit --verbose web/modules/custom",
"phpstan": "phpstan analyse web/modules/custom",
"post-update-cmd": ["Spoons\\ScriptHandler::createSymlinks"]
"drush/drush": "^10"
},
"minimum-stability": "dev",
"extra": {
"drush": {
"services": {
"drush.services.yml": "^9 || ^10"
}
},
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/libraries/{$name}": ["type:drupal-library"],
"web/modules/{$name}": ["type:drupal-module"],
"web/profiles/{$name}": ["type:drupal-profile"],
"web/themes/{$name}": ["type:drupal-theme"],
"drush/{$name}": ["type:drupal-drush"]
},
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
}
}
}
parameters:
customRulesetUsed: true
reportUnmatchedIgnoredErrors: false
includes:
- vendor/mglaman/phpstan-drupal/extension.neon
- vendor/phpstan/phpstan-deprecation-rules/rules.neon
<?xml version="1.0" encoding="UTF-8"?>
<!-- TODO set checkForUnintentionallyCoveredCode="true" once https://www.drupal.org/node/2626832 is resolved. -->
<!-- PHPUnit expects functional tests to be run with either a privileged user
or your current system user. See core/tests/README.md and
https://www.drupal.org/node/2116263 for details.
-->
<phpunit bootstrap="web/core/tests/bootstrap.php" colors="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutChangesToGlobalState="true"
printerClass="\Drupal\Tests\Listeners\HtmlOutputPrinter">
<php>
<!-- Set error reporting to E_ALL. -->
<ini name="error_reporting" value="32767"/>
<!-- Do not limit the amount of memory tests take to run. -->
<ini name="memory_limit" value="-1"/>
<!-- Example SIMPLETEST_BASE_URL value: http://localhost -->
<env name="SIMPLETEST_BASE_URL" value="http://127.0.0.1:8888"/>
<!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix -->
<env name="SIMPLETEST_DB" value="sqlite://localhost/sites/default/files/.sqlite"/>
<!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output -->
<env name="BROWSERTEST_OUTPUT_DIRECTORY" value="/tmp"/>
<!-- To have browsertest output use an alternative base URL. For example if
SIMPLETEST_BASE_URL is an internal DDEV URL, you can set this to the
external DDev URL so you can follow the links directly.
-->
<env name="BROWSERTEST_OUTPUT_BASE_URL" value=""/>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="disabled"/>
<!-- Example for changing the driver class for mink tests MINK_DRIVER_CLASS value: 'Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver' -->
<env name="MINK_DRIVER_CLASS" value=''/>
<!-- Example for changing the driver args to mink tests MINK_DRIVER_ARGS value: '["http://127.0.0.1:8510"]' -->
<env name="MINK_DRIVER_ARGS" value=''/>
<!-- Example for changing the driver args to phantomjs tests MINK_DRIVER_ARGS_PHANTOMJS value: '["http://127.0.0.1:8510"]' -->
<env name="MINK_DRIVER_ARGS_PHANTOMJS" value=''/>
<!-- Example for changing the driver args to webdriver tests MINK_DRIVER_ARGS_WEBDRIVER value: '["chrome", { "chromeOptions": { "w3c": false } }, "http://localhost:4444/wd/hub"]' For using the Firefox browser, replace "chrome" with "firefox" -->
<!-- Example from drupal.org https://dispatcher.drupalci.org/job/drupal_contrib/177251/console-->
<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", {"browserName":"chrome","chromeOptions":{"args":["--disable-gpu","--headless"]}}, "http://chrome:9515"]'/>
</php>
<testsuites>
<testsuite name="unit">
<file>./tests/TestSuites/UnitTestSuite.php</file>
</testsuite>
<testsuite name="kernel">
<file>./tests/TestSuites/KernelTestSuite.php</file>
</testsuite>
<testsuite name="functional">
<file>./tests/TestSuites/FunctionalTestSuite.php</file>
</testsuite>
<testsuite name="functional-javascript">
<file>./tests/TestSuites/FunctionalJavascriptTestSuite.php</file>
</testsuite>
<testsuite name="build">
<file>./tests/TestSuites/BuildTestSuite.php</file>
</testsuite>
</testsuites>
<listeners>
<listener class="\Drupal\Tests\Listeners\DrupalListener">
</listener>
<!-- The Symfony deprecation listener has to come after the Drupal listener -->
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
</listener>
</listeners>
<logging>
<log type="junit" target="junit.xml"/>
</logging>
</phpunit>
......@@ -132,7 +132,7 @@ class SimpleXmlTest extends KernelTestBase {
$this->configuration['urls'][0] = $url;
$this->expectException(MigrateException::class);
// Newer versions of libxml mark it as an error 76, older ones as 73.
$this->expectExceptionMessageRegExp('/^Fatal Error 7[0-9]/');
$this->expectExceptionMessageMatches('/^Fatal Error 7[0-9]/');
$parser = $this->pluginManager->createInstance('simple_xml', $this->configuration);
$parser->next();
}
......@@ -147,7 +147,7 @@ class SimpleXmlTest extends KernelTestBase {
$this->configuration['urls'][0] = $url;
$this->expectException(MigrateException::class);
$this->expectExceptionMessageRegExp('/^Fatal Error 76/');
$this->expectExceptionMessageMatches('/^Fatal Error 76/');
$parser = $this->pluginManager->createInstance('simple_xml', $this->configuration);
$parser->next();
......@@ -163,7 +163,7 @@ class SimpleXmlTest extends KernelTestBase {
$this->configuration['urls'][0] = $url;
$this->expectException(MigrateException::class);
$this->expectExceptionMessageRegExp('/^Fatal Error 46/');
$this->expectExceptionMessageMatches('/^Fatal Error 46/');
$parser = $this->pluginManager->createInstance('simple_xml', $this->configuration);
$parser->next();
}
......
......@@ -121,7 +121,7 @@ class HttpTest extends MigrateTestCase {
// Compare what we got back from the parser to what we expected to get.
$expected = json_decode($this->testData, TRUE);
$this->assertArrayEquals($expected, $body);
$this->assertSame($expected, $body);
}
/**
......@@ -139,7 +139,7 @@ class HttpTest extends MigrateTestCase {
$body = json_decode((string) $stream, TRUE);
$expected = json_decode($this->testData, TRUE);
$this->assertArrayEquals($expected, $body);
$this->assertSame($expected, $body);
}
/**
......
......@@ -95,7 +95,7 @@ class StrReplaceTest extends MigrateProcessTestCase {
$configuration['replace'] = 'that';
$plugin = new StrReplace($configuration, 'str_replace', []);
$actual = $plugin->transform($value, $this->migrateExecutable, $this->row, 'destinationproperty');
$this->assertArrayEquals($expected, $actual);
$this->assertSame($expected, $actual);
$this->assertTrue($plugin->multiple());
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment