class MixItUpDefaultOptionsServiceTest in MixItUp Views 8
Same name and namespace in other branches
- 8.2 tests/src/Unit/MixItUpDefaultOptionsServiceTest.php \Drupal\Tests\mixitup_views\Unit\MixItUpDefaultOptionsServiceTest
Class MixItUpDefaultOptionsServiceTest.
@group MixItUp Views @package Drupal\Tests\mixitup_views\Unit
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\mixitup_views\Unit\MixItUpDefaultOptionsServiceTest
Expanded class hierarchy of MixItUpDefaultOptionsServiceTest
File
- tests/
src/ Unit/ MixItUpDefaultOptionsServiceTest.php, line 14
Namespace
Drupal\Tests\mixitup_views\UnitView source
class MixItUpDefaultOptionsServiceTest extends UnitTestCase {
/**
* The MixitupViewsDefaultOptionsService instance.
*
* @var \Drupal\mixitup_views\MixitupViewsDefaultOptionsService
*/
protected $unit;
/**
* Before a test method is run, setUp() is invoked.
*
* Create new unit object.
*/
public function setUp() {
$this->unit = new MixitupViewsDefaultOptionsService();
}
/**
* Covers defaultOptions method if $convert param coming with a FALSE value.
*
* @covers \Drupal\mixitup_views\MixitupViewsDefaultOptionsService::defaultOptions
*/
public function testDefaultOptionsFalse() : void {
$options = [
'selectors' => [
'target' => '.mix',
'filter' => '.filter',
'sort' => '.sort',
],
'load' => [
'filter' => 'all',
'sort' => 'default:asc',
],
'animation' => [
'enable' => TRUE,
'effects' => 'fade scale',
'duration' => 600,
'easing' => 'ease',
'perspectiveDistance' => '3000px',
'perspectiveOrigin' => '50% 50%',
'queue' => TRUE,
'queueLimit' => 1,
],
'restrict' => [
'vocab' => FALSE,
'vocab_ids' => [],
],
];
$this
->assertEquals($options, $this->unit
->defaultOptions(NULL));
}
/**
* Covers defaultOptions method if $convert param coming with a TRUE value.
*
* @covers \Drupal\mixitup_views\MixitupViewsDefaultOptionsService::defaultOptions
*/
public function testDefaultOptionsTrue() : void {
$options = [
'selectors_target' => '.mix',
'selectors_filter' => '.filter',
'selectors_sort' => '.sort',
'load_filter' => 'all',
'load_sort' => 'default:asc',
'animation_enable' => TRUE,
'animation_effects' => 'fade scale',
'animation_duration' => 600,
'animation_easing' => 'ease',
'animation_perspectiveDistance' => '3000px',
'animation_perspectiveOrigin' => '50% 50%',
'animation_queue' => TRUE,
'animation_queueLimit' => 1,
'restrict_vocab' => FALSE,
'restrict_vocab_ids' => [],
];
$this
->assertEquals($options, $this->unit
->defaultOptions(TRUE));
}
/**
* If test has finished running, tearDown() will be invoked.
*
* Unset the $unit object.
*/
public function tearDown() {
unset($this->unit);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MixItUpDefaultOptionsServiceTest:: |
protected | property | The MixitupViewsDefaultOptionsService instance. | |
MixItUpDefaultOptionsServiceTest:: |
public | function |
Before a test method is run, setUp() is invoked. Overrides UnitTestCase:: |
|
MixItUpDefaultOptionsServiceTest:: |
public | function | If test has finished running, tearDown() will be invoked. | |
MixItUpDefaultOptionsServiceTest:: |
public | function | Covers defaultOptions method if $convert param coming with a FALSE value. | |
MixItUpDefaultOptionsServiceTest:: |
public | function | Covers defaultOptions method if $convert param coming with a TRUE value. | |
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. |