class DaysTest in Message 8
Same name in this branch
- 8 tests/src/Unit/Plugin/MessagePurge/DaysTest.php \Drupal\Tests\message\Unit\Plugin\MessagePurge\DaysTest
- 8 tests/src/Kernel/Plugin/MessagePurge/DaysTest.php \Drupal\Tests\message\Kernel\Plugin\MessagePurge\DaysTest
Unit tests for the days purge plugin.
@coversDefaultClass \Drupal\message\Plugin\MessagePurge\Days
@group Message
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\message\Unit\Plugin\MessagePurge\DaysTest
Expanded class hierarchy of DaysTest
File
- tests/
src/ Unit/ Plugin/ MessagePurge/ DaysTest.php, line 20
Namespace
Drupal\Tests\message\Unit\Plugin\MessagePurgeView source
class DaysTest extends UnitTestCase {
/**
* Test processing zero message.
*
* @covers ::process
*/
public function testProcessNone() {
$query = $this
->prophesize(QueryInterface::class)
->reveal();
$request_stack = $this
->prophesize(RequestStack::class)
->reveal();
$queue = $this
->prophesize(QueueInterface::class);
$queue
->createItem(Argument::any())
->shouldNotBeCalled();
$plugin = new Days([], 'days', [], $query, $queue
->reveal(), $request_stack);
$plugin
->process([]);
}
/**
* Tests processing more than defined queue item limit.
*
* @covers ::process
*/
public function testProcess() {
$query = $this
->prophesize(QueryInterface::class)
->reveal();
$request_stack = $this
->prophesize(RequestStack::class)
->reveal();
$queue = $this
->prophesize(QueueInterface::class);
$queue
->createItem(Argument::size(MessagePurgeInterface::MESSAGE_DELETE_SIZE))
->shouldBeCalledTimes(1);
$queue
->createItem(Argument::size(1))
->shouldBeCalledTimes(1);
$plugin = new Days([], 'days', [], $query, $queue
->reveal(), $request_stack);
$messages = range(1, MessagePurgeInterface::MESSAGE_DELETE_SIZE + 1);
$plugin
->process($messages);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DaysTest:: |
public | function | Tests processing more than defined queue item limit. | |
DaysTest:: |
public | function | Test processing zero message. | |
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. | |
UnitTestCase:: |
protected | function | 340 |