-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enabled Drupal 11 CI test jobs #39
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,16 +8,27 @@ | |
"phpmd/phpmd": "^2.15", | ||
"phpspec/prophecy-phpunit": "^2", | ||
"phpstan/extension-installer": "^1.3", | ||
"mglaman/composer-drupal-lenient": "^1", | ||
"vincentlanglet/twig-cs-fixer": "^2.8" | ||
}, | ||
"config": { | ||
"allow-plugins": { | ||
"dealerdirect/phpcodesniffer-composer-installer": true, | ||
"phpstan/extension-installer": true | ||
"phpstan/extension-installer": true, | ||
"mglaman/composer-drupal-lenient": true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am using this technique https://www.drupal.org/docs/develop/using-composer/using-drupals-lenient-composer-endpoint to solve |
||
} | ||
}, | ||
"extra": { | ||
"drupal-lenient": { | ||
"allowed-list": [ | ||
"drupal/config_filter" | ||
] | ||
}, | ||
"phpcodesniffer-search-depth": 10, | ||
"patches": {} | ||
"patches": { | ||
"drupal/config_filter": { | ||
"Automated Drupal 11 compatibility fixes for config_filter": "https://git.drupalcode.org/project/config_filter/-/merge_requests/9.patch" | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,6 @@ | |
|
||
namespace Drupal\Tests\generated_content\Traits; | ||
|
||
use PHPUnit\Framework\MockObject\Stub\Stub; | ||
|
||
/** | ||
* Trait GeneratedContentTestHelperTrait. | ||
* | ||
|
@@ -80,64 +78,6 @@ protected static function getProtectedValue(object $object, string $property) { | |
return $property->getValue($class); | ||
} | ||
|
||
/** | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AlexSkrypnyk |
||
* Helper to prepare class mock. | ||
* | ||
* @param class-string|object $class | ||
* Class name to generate the mock. | ||
* @param array<string, mixed|\PHPUnit\Framework\MockObject\Stub\Stub> $methodsMap | ||
* Optional array of methods and values, keyed by method name. | ||
* @param array<mixed> $args | ||
* Optional array of constructor arguments. If omitted, a constructor will | ||
* not be called. | ||
* | ||
* @return \PHPUnit\Framework\MockObject\MockObject|string | ||
* Mocked class. | ||
* | ||
* @throws \ReflectionException | ||
*/ | ||
protected function prepareMock($class, array $methodsMap = [], array $args = []) { | ||
$methods = array_keys($methodsMap); | ||
|
||
$reflectionClass = new \ReflectionClass($class); | ||
|
||
$class_name = is_object($class) ? get_class($class) : $class; | ||
|
||
if ($reflectionClass->isAbstract()) { | ||
$mock = $this->getMockForAbstractClass( | ||
$class_name, $args, '', !empty($args), TRUE, TRUE, $methods | ||
); | ||
} | ||
else { | ||
$mock = $this->getMockBuilder($class_name); | ||
if (!empty($args)) { | ||
$mock = $mock->enableOriginalConstructor() | ||
->setConstructorArgs($args); | ||
} | ||
else { | ||
$mock = $mock->disableOriginalConstructor(); | ||
} | ||
$mock = $mock->onlyMethods($methods) | ||
->getMock(); | ||
} | ||
|
||
foreach ($methodsMap as $method => $value) { | ||
// Handle callback values differently. | ||
if ($value instanceof Stub && strpos(get_class($value), 'Callback') !== FALSE) { | ||
$mock->expects($this->any()) | ||
->method($method) | ||
->will($value); | ||
} | ||
else { | ||
$mock->expects($this->any()) | ||
->method($method) | ||
->willReturn($value); | ||
} | ||
} | ||
|
||
return $mock; | ||
} | ||
|
||
/** | ||
* Check if testing framework was ran with --debug option. | ||
*/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this because D11 does not support php8.2