abstract class DiagnosticCheckTestBase in CloudFlare 8
Tests that purge_requirements() passes on our diagnostic checks.
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\cloudflarepurger\Unit\DiagnosticCheckTestBase
Expanded class hierarchy of DiagnosticCheckTestBase
File
- modules/
cloudflarepurger/ tests/ src/ Unit/ DiagnosticCheckTestBase.php, line 16
Namespace
Drupal\Tests\cloudflarepurger\UnitView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DiagnosticCheckTestBase:: |
protected | property | Tracks rate limits associated with CloudFlare Api. | |
DiagnosticCheckTestBase:: |
protected | property | Provides check for composer dependencies. | |
DiagnosticCheckTestBase:: |
protected | property | The dependency injection container. | |
DiagnosticCheckTestBase:: |
protected | property | Tracks Drupal states. | |
DiagnosticCheckTestBase:: |
protected | property | Provides timestamps. | |
DiagnosticCheckTestBase:: |
public | function |
Overrides UnitTestCase:: |
1 |
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. |