FakeInjectableTrait.php 939 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of the league/commonmark package.
  5. *
  6. * (c) Colin O'Dell <colinodell@gmail.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace League\CommonMark\Tests\Unit\Environment;
  12. use League\CommonMark\Environment\EnvironmentInterface;
  13. use League\Config\ConfigurationInterface;
  14. trait FakeInjectableTrait
  15. {
  16. protected bool $configInjected = false;
  17. protected bool $environmentInjected = false;
  18. public function setConfiguration(ConfigurationInterface $configuration): void
  19. {
  20. $this->configInjected = true;
  21. }
  22. public function setEnvironment(EnvironmentInterface $environment): void
  23. {
  24. $this->environmentInjected = true;
  25. }
  26. public function bothWereInjected(): bool
  27. {
  28. return $this->configInjected && $this->environmentInjected;
  29. }
  30. }