charts_highcharts_drilldown-1.0.0-alpha1/tests/src/Unit/Plugin/DrilldownPluginTest.php
tests/src/Unit/Plugin/DrilldownPluginTest.php
<?php namespace Drupal\Tests\charts_highcharts_drilldown\Unit\Plugin; use Drupal\Tests\UnitTestCase; use Drupal\charts_highcharts_drilldown\Plugin\views\style\ChartsDrilldownPluginStyleChart; /** * @coversDefaultClass \Drupal\charts_highcharts_drilldown\Plugin\views\style\ChartsDrilldownPluginStyleChart * @group charts_highcharts_drilldown */ class DrilldownPluginTest extends UnitTestCase { /** * {@inheritdoc} */ public function setUp(): void { parent::setUp(); } /** * Test the colorIndexUnderTen() method. * * @requires module charts */ public function testColorIndexUnderTen() { $this->assertEquals(1, ChartsDrilldownPluginStyleChart::getColorIndex(1)); $this->assertEquals(8, ChartsDrilldownPluginStyleChart::getColorIndex(8)); } /** * Test the colorIndexUpTen() method. * * @requires module charts */ public function testColorIndexUpTen() { $this->assertEquals(1, ChartsDrilldownPluginStyleChart::getColorIndex(10)); $this->assertEquals(6, ChartsDrilldownPluginStyleChart::getColorIndex(15)); $this->assertEquals(5, ChartsDrilldownPluginStyleChart::getColorIndex(59)); } /** * Test the fieldDisabled() method. * * @requires module charts */ public function testFieldDisabled() { $input = [ "enabled" => FALSE, "color" => "#000000", "weight" => 121, ]; $this->assertEquals(FALSE, ChartsDrilldownPluginStyleChart::checkFieldEnabled($input)); } /** * Test the fieldEnabled() method. * * @requires module charts */ public function testFieldEnabled() { $input = [ "enabled" => TRUE, "color" => "#000000", "weight" => 121, ]; $this->assertEquals(TRUE, ChartsDrilldownPluginStyleChart::checkFieldEnabled($input)); } /** * Test the fieldMissignEnabled() method. * * @requires module charts */ public function testFieldMissingEnabled() { $input = [ "color" => "#000000", "weight" => 121, ]; $this->assertEquals(FALSE, ChartsDrilldownPluginStyleChart::checkFieldEnabled($input)); } /** * Test the fieldEnabledNoArray() method. * * @requires module charts */ public function testFieldEnabledNoArray() { $this->assertEquals(FALSE, ChartsDrilldownPluginStyleChart::checkFieldEnabled(NULL)); $this->assertEquals(FALSE, ChartsDrilldownPluginStyleChart::checkFieldEnabled('STRING')); } }