diff --git a/composer.json b/composer.json index 644b0d1..4090c8c 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ "require-dev": { "phpunit/phpunit": "^9.5.0", "drupal/pathauto": "^1.6", - "drupal/coder": "^8.2" + "drupal/coder": "^8.2", + "phpspec/prophecy-phpunit": "^2.0" }, "repositories": { "0": { diff --git a/src/Core/Path/AliasManagerTrait.php b/src/Core/Path/AliasManagerTrait.php index 5647a3a..8d13e60 100644 --- a/src/Core/Path/AliasManagerTrait.php +++ b/src/Core/Path/AliasManagerTrait.php @@ -2,7 +2,7 @@ namespace drunomics\ServiceUtils\Core\Path; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path_alias\AliasManagerInterface; /** * Allows setter injection and simple usage of the service. @@ -12,14 +12,14 @@ trait AliasManagerTrait { /** * The alias manager. * - * @var \Drupal\Core\Path\AliasManagerInterface + * @var \Drupal\path_alias\AliasManagerInterface */ protected $aliasManager; /** * Sets the entity type. * - * @param \Drupal\Core\Path\AliasManagerInterface $aliasManager + * @param \Drupal\path_alias\AliasManagerInterface $aliasManager * The alias manager. * * @return $this @@ -32,12 +32,12 @@ public function setAliasManager(AliasManagerInterface $aliasManager) { /** * Gets the entity repository. * - * @return \Drupal\Core\Path\AliasManagerInterface + * @return \Drupal\path_alias\AliasManagerInterface * The alias manager. */ public function getAliasManager() { if (empty($this->aliasManager)) { - $this->aliasManager = \Drupal::service('path.alias_manager'); + $this->aliasManager = \Drupal::service('path_alias.manager'); } return $this->aliasManager; } diff --git a/src/user/SharedTempStoreFactoryTrait.php b/src/user/SharedTempStoreFactoryTrait.php index 5119726..d245e20 100644 --- a/src/user/SharedTempStoreFactoryTrait.php +++ b/src/user/SharedTempStoreFactoryTrait.php @@ -2,7 +2,7 @@ namespace drunomics\ServiceUtils\user; -use Drupal\user\SharedTempStoreFactory; +use Drupal\Core\TempStore\SharedTempStoreFactory; /** * Allows setter injection and simple usage of the service. diff --git a/tests/src/Core/Config/ConfigFactoryTraitTest.php b/tests/src/Core/Config/ConfigFactoryTraitTest.php index 8fa3f85..9f60b33 100644 --- a/tests/src/Core/Config/ConfigFactoryTraitTest.php +++ b/tests/src/Core/Config/ConfigFactoryTraitTest.php @@ -6,6 +6,7 @@ use drunomics\ServiceUtils\Core\Config\ConfigFactoryTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\Config\ConfigFactoryInterface; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\Config\ConfigFactoryTrait @@ -14,6 +15,7 @@ class ConfigFactoryTraitTest extends TestCase { use ConfigFactoryTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/Core/Entity/EntityRepositoryTraitTest.php b/tests/src/Core/Entity/EntityRepositoryTraitTest.php index 9ff03b4..49fc184 100644 --- a/tests/src/Core/Entity/EntityRepositoryTraitTest.php +++ b/tests/src/Core/Entity/EntityRepositoryTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\Core\Entity\EntityTypeManagerTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\Entity\EntityTypeManagerInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\Entity\EntityTypeManagerTrait * @group ServiceUtils */ -class EntityRepositoryTraitTest extends \PHPUnit_Framework_TestCase { +class EntityRepositoryTraitTest extends TestCase { use EntityTypeManagerTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/Core/Entity/EntityTypeManagerTraitTest.php b/tests/src/Core/Entity/EntityTypeManagerTraitTest.php index 8777e8b..63cf8c4 100644 --- a/tests/src/Core/Entity/EntityTypeManagerTraitTest.php +++ b/tests/src/Core/Entity/EntityTypeManagerTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\Core\Entity\EntityRepositoryTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\Entity\EntityRepositoryInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\Entity\EntityRepositoryTrait * @group ServiceUtils */ -class EntityTypeManagerTraitTest extends \PHPUnit_Framework_TestCase { +class EntityTypeManagerTraitTest extends TestCase { use EntityRepositoryTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/Core/File/FileSystemTraitTest.php b/tests/src/Core/File/FileSystemTraitTest.php index e618b5c..af9aff1 100644 --- a/tests/src/Core/File/FileSystemTraitTest.php +++ b/tests/src/Core/File/FileSystemTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\Core\File\FileSystemTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\File\FileSystemInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\File\FileSystemTrait * @group ServiceUtils */ -class FileSystemTraitTest extends \PHPUnit_Framework_TestCase { +class FileSystemTraitTest extends TestCase { use FileSystemTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/Core/Path/AliasManagerTraitTest.php b/tests/src/Core/Path/AliasManagerTraitTest.php index 77dcf87..7bd4293 100644 --- a/tests/src/Core/Path/AliasManagerTraitTest.php +++ b/tests/src/Core/Path/AliasManagerTraitTest.php @@ -4,22 +4,25 @@ use drunomics\ServiceUtils\Core\Path\AliasManagerTrait; use Drupal\Core\DependencyInjection\Container; -use Drupal\Core\Path\AliasManagerInterface; +use Drupal\path_alias\AliasManagerInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\Path\AliasManagerTrait * @group ServiceUtils */ -class AliasManagerTraitTest extends \PHPUnit_Framework_TestCase { +class AliasManagerTraitTest extends TestCase { use AliasManagerTrait; + use ProphecyTrait; /** * The id of the trait's service. * * @var string */ - protected $serviceId = 'path.alias_manager'; + protected $serviceId = 'path_alias.manager'; /** * @covers ::getAliasManager @@ -36,7 +39,7 @@ public function testGetter() { * @covers ::setAliasManager */ public function testSetter() { - // Verify the set service is returned. +// Verify the set service is returned. $this->mockContainerWithFakeService(['calls' => 0]); $service = $this->prophesize() ->willImplement(AliasManagerInterface::class) diff --git a/tests/src/Core/Plugin/BlockManagerTraitTest.php b/tests/src/Core/Plugin/BlockManagerTraitTest.php index dbb68fc..cfa894f 100644 --- a/tests/src/Core/Plugin/BlockManagerTraitTest.php +++ b/tests/src/Core/Plugin/BlockManagerTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\Core\Plugin\BlockManagerTrait; use Drupal\Core\Block\BlockManagerInterface; use Drupal\Core\DependencyInjection\Container; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\Entity\EntityTypeManagerTrait * @group ServiceUtils */ -class BlockManagerTraitTest extends \PHPUnit_Framework_TestCase { +class BlockManagerTraitTest extends TestCase { use BlockManagerTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/Core/Render/MainContent/AjaxRendererTraitTest.php b/tests/src/Core/Render/MainContent/AjaxRendererTraitTest.php index 105a3db..fac4f90 100644 --- a/tests/src/Core/Render/MainContent/AjaxRendererTraitTest.php +++ b/tests/src/Core/Render/MainContent/AjaxRendererTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\Core\Render\MainContent\AjaxRendererTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\Render\MainContent\MainContentRendererInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\Render\MainContent\AjaxRendererTrait * @group ServiceUtils */ -class AjaxRendererTraitTest extends \PHPUnit_Framework_TestCase { +class AjaxRendererTraitTest extends TestCase { use AjaxRendererTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/Core/Render/RendererTraitTest.php b/tests/src/Core/Render/RendererTraitTest.php index 03afd95..a900a54 100644 --- a/tests/src/Core/Render/RendererTraitTest.php +++ b/tests/src/Core/Render/RendererTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\Core\Render\RendererTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\Render\RendererInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\Render\RendererTrait * @group ServiceUtils */ -class RendererTraitTest extends \PHPUnit_Framework_TestCase { +class RendererTraitTest extends TestCase { use RendererTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/Core/Session/CurrentUserTraitTest.php b/tests/src/Core/Session/CurrentUserTraitTest.php index fbf1f4f..3fe4438 100644 --- a/tests/src/Core/Session/CurrentUserTraitTest.php +++ b/tests/src/Core/Session/CurrentUserTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\Core\Session\CurrentUserTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\Session\AccountProxyInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\Session\CurrentUserTrait * @group ServiceUtils */ -class CurrentUserTraitTest extends \PHPUnit_Framework_TestCase { +class CurrentUserTraitTest extends TestCase { use CurrentUserTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/Core/State/StateTraitTest.php b/tests/src/Core/State/StateTraitTest.php index f46773e..09e5b57 100644 --- a/tests/src/Core/State/StateTraitTest.php +++ b/tests/src/Core/State/StateTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\Core\State\StateTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\Core\State\StateInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\Core\State\StateTrait * @group ServiceUtils */ -class StateTraitTest extends \PHPUnit_Framework_TestCase { +class StateTraitTest extends TestCase { use StateTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/Symfony/HttpFoundation/RequestStackTraitTest.php b/tests/src/Symfony/HttpFoundation/RequestStackTraitTest.php index c326c07..8ec15c0 100644 --- a/tests/src/Symfony/HttpFoundation/RequestStackTraitTest.php +++ b/tests/src/Symfony/HttpFoundation/RequestStackTraitTest.php @@ -4,15 +4,18 @@ use drunomics\ServiceUtils\Symfony\HttpFoundation\RequestStackTrait; use Drupal\Core\DependencyInjection\Container; +use Prophecy\PhpUnit\ProphecyTrait; use Symfony\Component\HttpFoundation\RequestStack; +use PHPUnit\Framework\TestCase; /** * @coversDefaultClass \drunomics\ServiceUtils\Symfony\HttpFoundation\RequestStackTrait * @group ServiceUtils */ -class RequestStackTraitTest extends \PHPUnit_Framework_TestCase { +class RequestStackTraitTest extends TestCase { use RequestStackTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/file/FileUsage/FileUsageTraitTest.php b/tests/src/file/FileUsage/FileUsageTraitTest.php index 4c13931..1a80acb 100644 --- a/tests/src/file/FileUsage/FileUsageTraitTest.php +++ b/tests/src/file/FileUsage/FileUsageTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\file\FileUsage\FileUsageTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\file\FileUsage\FileUsageInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\file\FileUsage\FileUsageTrait * @group ServiceUtils */ -class FileUsageTraitTest extends \PHPUnit_Framework_TestCase { +class FileUsageTraitTest extends TestCase { use FileUsageTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/pathauto/PathautoGeneratorTraitTest.php b/tests/src/pathauto/PathautoGeneratorTraitTest.php index 343c10b..6134ce9 100644 --- a/tests/src/pathauto/PathautoGeneratorTraitTest.php +++ b/tests/src/pathauto/PathautoGeneratorTraitTest.php @@ -5,14 +5,17 @@ use drunomics\ServiceUtils\pathauto\PathautoGeneratorTrait; use Drupal\Core\DependencyInjection\Container; use Drupal\pathauto\PathautoGeneratorInterface; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\pathauto\PathautoGeneratorTrait * @group ServiceUtils */ -class PathautoGeneratorTraitTest extends \PHPUnit_Framework_TestCase { +class PathautoGeneratorTraitTest extends TestCase { use PathautoGeneratorTrait; + use ProphecyTrait; /** * The id of the trait's service. diff --git a/tests/src/user/SharedTempStoreFactoryTraitTest.php b/tests/src/user/SharedTempStoreFactoryTraitTest.php index ccc84e7..cebbf5e 100644 --- a/tests/src/user/SharedTempStoreFactoryTraitTest.php +++ b/tests/src/user/SharedTempStoreFactoryTraitTest.php @@ -4,15 +4,18 @@ use drunomics\ServiceUtils\user\SharedTempStoreFactoryTrait; use Drupal\Core\DependencyInjection\Container; -use Drupal\user\SharedTempStoreFactory; +use Drupal\Core\TempStore\SharedTempStoreFactory; +use PHPUnit\Framework\TestCase; +use Prophecy\PhpUnit\ProphecyTrait; /** * @coversDefaultClass \drunomics\ServiceUtils\user\SharedTempStoreFactoryTrait * @group ServiceUtils */ -class SharedTempStoreFactoryTraitTest extends \PHPUnit_Framework_TestCase { +class SharedTempStoreFactoryTraitTest extends TestCase { use SharedTempStoreFactoryTrait; + use ProphecyTrait; /** * The id of the trait's service.