Skip to content

Commit

Permalink
Issue #3329254: Automated Drupal 10 compatibility fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
WengerK committed Mar 11, 2024
1 parent 423922b commit bee58f1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Github repo

```bash
git remote add github \
https://github.com/antistatique/drupal-factory-lollipop.git
git@github.com:antistatique/drupal-factory-lollipop.git
```

## 🔧 Prerequisites
Expand Down
4 changes: 3 additions & 1 deletion tests/src/Kernel/FactoryType/FileFactoryTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\Tests\factory_lollipop\Kernel\FactoryType;

use Prophecy\PhpUnit\ProphecyTrait;
use Drupal\Core\Config\ConfigFactoryInterface;

Check failure on line 6 in tests/src/Kernel/FactoryType/FileFactoryTypeTest.php

View workflow job for this annotation

GitHub Actions / phpcs

Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
use Drupal\Core\Config\ImmutableConfig;
use Drupal\Core\File\FileSystemInterface;
Expand All @@ -15,6 +16,7 @@
*/
class FileFactoryTypeTest extends EntityKernelTestBase {

use ProphecyTrait;
/**
* The Node Factory resolver.
*
Expand Down Expand Up @@ -70,7 +72,7 @@ public function testCreateNotFilePathAttribute(): void {
$this->expectExceptionMessageMatches('#^File ".+/core/tests/fixtures/foo" does not exist\.$#');
}
else {
$this->expectExceptionMessageRegExp('#^File ".+/core/tests/fixtures/foo" does not exist\.$#');
$this->expectExceptionMessageMatches('#^File ".+/core/tests/fixtures/foo" does not exist\.$#');
}
$this->fileFactoryTypeResolver->create((object) ['path' => $file_path]);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/src/Kernel/FactoryType/MediaTypeFactoryTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function testCreateNotExistingSource(): void {
$this->expectExceptionMessageMatches('#^The "foo" plugin does not exist\. Valid plugin IDs.+$#');
}
else {
$this->expectExceptionMessageRegExp('#^The "foo" plugin does not exist\. Valid plugin IDs.+$#');
$this->expectExceptionMessageMatches('#^The "foo" plugin does not exist\. Valid plugin IDs.+$#');
}
$this->mediaTypeFactoryTypeResolver->create((object) [
'source' => 'foo',
Expand Down
2 changes: 2 additions & 0 deletions tests/src/Unit/FactoryType/FileFactoryTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\Tests\factory_lollipop\Unit\Resolver\FactoryType;

use Prophecy\PhpUnit\ProphecyTrait;
use Drupal\Core\Config\ConfigFactoryInterface;

Check failure on line 6 in tests/src/Unit/FactoryType/FileFactoryTypeTest.php

View workflow job for this annotation

GitHub Actions / phpcs

Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\ConfigFactoryInterface.
use Drupal\Core\Config\ImmutableConfig;
use Drupal\Core\File\FileSystemInterface;
Expand All @@ -15,6 +16,7 @@
*/
class FileFactoryTypeTest extends UnitTestCase {

use ProphecyTrait;
/**
* The File Factory resolver.
*
Expand Down
12 changes: 3 additions & 9 deletions tests/src/Unit/FixtureFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public function setUp(): void {
* @see \Drupal\Tests\factory_lollipop_test\Kernel\VocabularyFactoryTest
*/
public function testCreate(): void {
$factory_type_foo = $this->getMockBuilder(FactoryTypeInterface::class)
->disableOriginalConstructor()
->getMock();
$factory_type_foo = $this->createMock(FactoryTypeInterface::class);

$factory_type_foo
->expects(self::once())
Expand All @@ -70,18 +68,14 @@ public function testCreate(): void {
->method('create')
->with(self::equalTo((object) ['default' => 'lorem', 'arg1' => 'bar']));

$chain_factory_type_resolver = $this->getMockBuilder(ChainFactoryTypeResolver::class)
->disableOriginalConstructor()
->getMock();
$chain_factory_type_resolver = $this->createMock(ChainFactoryTypeResolver::class);

$chain_factory_type_resolver
->expects(self::once())
->method('getResolvers')
->willReturn([$factory_type_foo]);

$chain_factory_resolver = $this->getMockBuilder(ChainFactoryResolver::class)
->disableOriginalConstructor()
->getMock();
$chain_factory_resolver = $this->createMock(ChainFactoryResolver::class);

$factory_Lollipop = $this->getMockBuilder(FixtureFactory::class)
->setConstructorArgs([
Expand Down

0 comments on commit bee58f1

Please sign in to comment.