class ChartsDefaultColorsTest in Charts 8.3
Same name and namespace in other branches
- 8.4 tests/src/Unit/Settings/ChartsDefaultColorsTest.php \Drupal\Tests\charts\Unit\Settings\ChartsDefaultColorsTest
- 5.0.x tests/src/Unit/Settings/ChartsDefaultColorsTest.php \Drupal\Tests\charts\Unit\Settings\ChartsDefaultColorsTest
Tests the ChartDefaultColors class.
@coversDefaultClass \Drupal\charts\Settings\ChartsDefaultColors @group charts
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\charts\Unit\Settings\ChartsDefaultColorsTest
Expanded class hierarchy of ChartsDefaultColorsTest
File
- tests/
src/ Unit/ Settings/ ChartsDefaultColorsTest.php, line 14
Namespace
Drupal\Tests\charts\Unit\SettingsView source
class ChartsDefaultColorsTest extends UnitTestCase {
/**
* @var \Drupal\charts\Settings\ChartsDefaultColors
*/
private $chartsDefaultColors;
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->chartsDefaultColors = new ChartsDefaultColors();
}
/**
* {@inheritdoc}
*/
public function tearDown() {
parent::tearDown();
$this->chartsDefaultColors = NULL;
}
/**
* Tests the number of default colors.
*/
public function testNumberOfDefaultColors() {
$this
->assertCount(10, $this->chartsDefaultColors
->getDefaultColors());
}
/**
* Tests getter and setter for default colors.
*
* @param array $color
* An array of color codes.
*
* @dataProvider colorProvider
*/
public function testDefaultColors(array $color) {
$this->chartsDefaultColors
->setDefaultColors($color);
$this
->assertArrayEquals($color, $this->chartsDefaultColors
->getDefaultColors());
}
/**
* Data provider for setDefaultColors().
*/
public function colorProvider() {
(yield [
[
'#2f7ed8',
],
]);
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ChartsDefaultColorsTest:: |
private | property | ||
ChartsDefaultColorsTest:: |
public | function | Data provider for setDefaultColors(). | |
ChartsDefaultColorsTest:: |
public | function |
Overrides UnitTestCase:: |
|
ChartsDefaultColorsTest:: |
public | function | ||
ChartsDefaultColorsTest:: |
public | function | Tests getter and setter for default colors. | |
ChartsDefaultColorsTest:: |
public | function | Tests the number of default colors. | |
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. |