ChartAttachmentServiceTest.php in Charts 5.0.x
Same filename and directory in other branches
Namespace
Drupal\Tests\charts\Unit\ServicesFile
tests/src/Unit/Services/ChartAttachmentServiceTest.phpView source
<?php
namespace Drupal\Tests\charts\Unit\Services;
use Drupal\Tests\UnitTestCase;
use Drupal\charts\Services\ChartAttachmentService;
/**
* @coversDefaultClass \Drupal\charts\Services\ChartAttachmentService
* @group charts
*/
class ChartAttachmentServiceTest extends UnitTestCase {
/**
* The chart attachment service.
*
* @var \Drupal\charts\Services\ChartAttachmentService
*/
private $chartAttachmentService;
/**
* {@inheritdoc}
*/
public function setUp() {
parent::setUp();
$this->chartAttachmentService = new ChartAttachmentService();
}
/**
* Tests getter and setter for attachments.
*
* @param array $attachmentViews
* Array of attachments.
*
* @dataProvider attachmentViews
*/
public function testAttachmentViews(array $attachmentViews) {
$this->chartAttachmentService
->setAttachmentViews($attachmentViews);
$this
->assertArrayEquals($attachmentViews, $this->chartAttachmentService
->getAttachmentViews());
}
/**
* Data provider for testAttachmentView().
*/
public function attachmentViews() {
(yield [
[
new \stdClass(),
],
]);
}
}
Classes
Name | Description |
---|---|
ChartAttachmentServiceTest | @coversDefaultClass \Drupal\charts\Services\ChartAttachmentService @group charts |