Skip to content

Commit

Permalink
Updated PHPunit continuous integration action. Added static instance(…
Browse files Browse the repository at this point in the history
…)` function to ChartOption class.
  • Loading branch information
laurentmuller committed Nov 24, 2024
1 parent 3eaf9bb commit 7f095a3
Show file tree
Hide file tree
Showing 13 changed files with 132 additions and 121 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/php_unit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ jobs:
run: vendor/bin/phpunit --display-skipped --no-progress --coverage-clover ./clover.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4.6.0
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: 'laurentmuller/HighchartsBundle'
disable_search: true
file: ./clover.xml
files: ./clover.xml
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- Updated `PHPunit` continuous integration action.
- Added static `instance()` function to `ChartOption` class.
- Added test for the `renderTo` property.
- Updated `PHPStan` to version 2.0 and level to 10.
- Removed separate `PHPUnit` tool.
Expand Down
64 changes: 32 additions & 32 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions src/Highcharts/AbstractChart.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,20 @@ abstract class AbstractChart implements ChartInterface

public function __construct()
{
$this->accessibility = new ChartOption('accessibility');
$this->chart = new ChartOption('chart');
$this->credits = new ChartOption('credits');
$this->exporting = new ChartOption('exporting');
$this->global = new ChartOption('global');
$this->lang = new ChartOption('lang');
$this->legend = new ChartOption('legend');
$this->plotOptions = new ChartOption('plotOptions');
$this->series = new ChartOption('series');
$this->subtitle = new ChartOption('subtitle');
$this->title = new ChartOption('title');
$this->tooltip = new ChartOption('tooltip');
$this->xAxis = new ChartOption('xAxis');
$this->yAxis = new ChartOption('yAxis');
$this->accessibility = ChartOption::instance('accessibility');
$this->chart = ChartOption::instance('chart');
$this->credits = ChartOption::instance('credits');
$this->exporting = ChartOption::instance('exporting');
$this->global = ChartOption::instance('global');
$this->lang = ChartOption::instance('lang');
$this->legend = ChartOption::instance('legend');
$this->plotOptions = ChartOption::instance('plotOptions');
$this->series = ChartOption::instance('series');
$this->subtitle = ChartOption::instance('subtitle');
$this->title = ChartOption::instance('title');
$this->tooltip = ChartOption::instance('tooltip');
$this->xAxis = ChartOption::instance('xAxis');
$this->yAxis = ChartOption::instance('yAxis');
}

public function __call(string $name, mixed $value): static
Expand Down
10 changes: 10 additions & 0 deletions src/Highcharts/ChartOption.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ public function hasData(): bool
return [] !== $this->data;
}

/**
* Create a new instance.
*
* @psalm-param non-empty-string $name
*/
public static function instance(string $name): self
{
return new self($name);
}

public function merge(array $data): self
{
$this->data = \array_merge_recursive($this->data, $data);
Expand Down
8 changes: 4 additions & 4 deletions src/Highcharts/Highchart.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ class Highchart extends AbstractChart
public function __construct()
{
parent::__construct();
$this->colorAxis = new ChartOption('colorAxis');
$this->drilldown = new ChartOption('drilldown');
$this->noData = new ChartOption('noData');
$this->pane = new ChartOption('pane');
$this->colorAxis = ChartOption::instance('colorAxis');
$this->drilldown = ChartOption::instance('drilldown');
$this->noData = ChartOption::instance('noData');
$this->pane = ChartOption::instance('pane');
}

protected function getChartClass(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Highcharts/Highstock.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Highstock extends AbstractChart
public function __construct()
{
parent::__construct();
$this->rangeSelector = new ChartOption('rangeSelector');
$this->rangeSelector = ChartOption::instance('rangeSelector');
}

protected function getChartClass(): string
Expand Down
2 changes: 1 addition & 1 deletion tests/Highcharts/ChartOptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,6 @@ public function testUnset(): void

private function createOption(): ChartOption
{
return new ChartOption('test');
return ChartOption::instance('test');
}
}
1 change: 0 additions & 1 deletion tests/Twig/TwigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public function testTwigMembers(): void
$extension = new HighchartsExtension();
self::assertCount(0, $extension->getFilters());
self::assertCount(0, $extension->getNodeVisitors());
self::assertCount(2, $extension->getOperators());
self::assertCount(0, $extension->getTests());
self::assertCount(0, $extension->getTokenParsers());

Expand Down
Loading

0 comments on commit 7f095a3

Please sign in to comment.