You are here

abstract class DiagnosticCheckTestBase in CloudFlare 8

Tests that purge_requirements() passes on our diagnostic checks.

Hierarchy

Expanded class hierarchy of DiagnosticCheckTestBase

File

modules/cloudflarepurger/tests/src/Unit/DiagnosticCheckTestBase.php, line 16

Namespace

Drupal\Tests\cloudflarepurger\Unit
View source
abstract class DiagnosticCheckTestBase extends UnitTestCase {

  /**
   * The dependency injection container.
   *
   * @var \Drupal\Core\DependencyInjection\ContainerBuilder
   */
  protected $container;

  /**
   * Tracks Drupal states.
   *
   * @var \Drupal\Core\state\StateInterface
   */
  protected $drupalState;

  /**
   * Tracks rate limits associated with CloudFlare Api.
   *
   * @var \Drupal\cloudflare\CloudFlareStateInterface
   */
  protected $cloudflareState;

  /**
   * Provides timestamps.
   *
   * @var \Drupal\cloudflare\Timestamp
   */
  protected $timestampStub;

  /**
   * Provides check for composer dependencies.
   *
   * @var \Drupal\cloudflare\CloudFlareComposerDependenciesCheckInterface
   */
  protected $composerDependencyStub;

  /**
   * {@inheritdoc}
   */
  public function setUp() {
    parent::setUp();
    $this->drupalState = new CoreState(new KeyValueMemoryFactory(), new MemoryBackend('test'), new NullLockBackend());
    $this->timestampStub = $this
      ->getMockBuilder('Drupal\\cloudflare\\Timestamp')
      ->disableOriginalConstructor()
      ->getMock();
    $this->cloudflareState = new CloudFlareState($this->drupalState, $this->timestampStub);
    $this->container = new ContainerBuilder();
    $this->container
      ->set('string_translation', $this
      ->getStringTranslationStub());
    $this->composerDependencyStub = $this
      ->createMock('\\Drupal\\cloudflare\\CloudFlareComposerDependenciesCheckInterface');
    $this->composerDependencyStub
      ->expects($this
      ->any())
      ->method('check')
      ->will($this
      ->returnValue(TRUE));
    $this->container
      ->set('cloudflare.composer_dependency_check', $this->composerDependencyStub);
    \Drupal::setContainer($this->container);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DiagnosticCheckTestBase::$cloudflareState protected property Tracks rate limits associated with CloudFlare Api.
DiagnosticCheckTestBase::$composerDependencyStub protected property Provides check for composer dependencies.
DiagnosticCheckTestBase::$container protected property The dependency injection container.
DiagnosticCheckTestBase::$drupalState protected property Tracks Drupal states.
DiagnosticCheckTestBase::$timestampStub protected property Provides timestamps.
DiagnosticCheckTestBase::setUp public function Overrides UnitTestCase::setUp 1
PhpunitCompatibilityTrait::getMock Deprecated public function Returns a mock object for the specified class using the available method.
PhpunitCompatibilityTrait::setExpectedException Deprecated public function Compatibility layer for PHPUnit 6 to support PHPUnit 4 code.
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root. 1
UnitTestCase::assertArrayEquals protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getBlockMockWithMachineName Deprecated protected function Mocks a block with a block plugin. 1
UnitTestCase::getClassResolverStub protected function Returns a stub class resolver.
UnitTestCase::getConfigFactoryStub public function Returns a stub config factory that behaves according to the passed array.
UnitTestCase::getConfigStorageStub public function Returns a stub config storage that returns the supplied configuration.
UnitTestCase::getContainerWithCacheTagsInvalidator protected function Sets up a container with a cache tags invalidator.
UnitTestCase::getRandomGenerator protected function Gets the random generator for the utility methods.
UnitTestCase::getStringTranslationStub public function Returns a stub translation manager that just returns the passed string.
UnitTestCase::randomMachineName public function Generates a unique random string containing letters and numbers.