class XlsxExporterTest in Webform XLSX export 8
Class XlsxExporterTest.
@package Drupal\Tests\webform_xlsx_export\Unit
@group webform_xlsx_export
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\webform_xlsx_export\Unit\XlsxExporterTest
Expanded class hierarchy of XlsxExporterTest
File
- tests/
src/ Unit/ XlsxExporterTest.php, line 20
Namespace
Drupal\Tests\webform_xlsx_export\UnitView source
class XlsxExporterTest extends UnitTestCase {
/**
* Exporter class used in tests.
*
* @var \Drupal\webform_xlsx_export\Plugin\WebformExporter\XlsxExporter
*/
private $exporter;
/**
* Prepare variables used in tests.
*/
protected function setUp() {
parent::setUp();
/** @var \Psr\Log\LoggerInterface $logger */
$logger = $this
->createMock(LoggerInterface::class);
/** @var \Drupal\Core\Config\ConfigFactoryInterface $config_factory */
$config_factory = $this
->createMock(ConfigFactoryInterface::class);
/** @var \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager */
$entity_type_manager = $this
->createMock(EntityTypeManagerInterface::class);
/** @var \Drupal\webform\Plugin\WebformElementManagerInterface $element_manager */
$element_manager = $this
->createMock(WebformElementManagerInterface::class);
/** @var \Drupal\webform\WebformTokenManagerInterface $token_manager */
$token_manager = $this
->createMock(WebformTokenManagerInterface::class);
$this->exporter = new XlsxExporter([], 'foo', NULL, $logger, $config_factory, $entity_type_manager, $element_manager, $token_manager);
}
/**
* Test getFileExtension().
*/
public function testGetFileExtension() {
$this
->assertEquals('xlsx', $this->exporter
->getFileExtension());
}
/**
* Test createExport().
*/
public function testCreateExport() {
$this
->assertNull($this->exporter
->createExport());
}
/**
* Test openExport().
*/
public function testOpenExport() {
$this
->markTestIncomplete('We need to mock ConfigFactoryInterface.');
}
/**
* Test closeExport().
*/
public function testCloseExport() {
$this
->markTestIncomplete('We need to mock ConfigFactoryInterface.');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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. | |
XlsxExporterTest:: |
private | property | Exporter class used in tests. | |
XlsxExporterTest:: |
protected | function |
Prepare variables used in tests. Overrides UnitTestCase:: |
|
XlsxExporterTest:: |
public | function | Test closeExport(). | |
XlsxExporterTest:: |
public | function | Test createExport(). | |
XlsxExporterTest:: |
public | function | Test getFileExtension(). | |
XlsxExporterTest:: |
public | function | Test openExport(). |