class TamperableComplexDataAdapterTest in Tamper 8
@coversDefaultClass \Drupal\tamper\Adapter\TamperableComplexDataAdapter @group tamper
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\tamper\Unit\Adapter\TamperableComplexDataAdapterTest
Expanded class hierarchy of TamperableComplexDataAdapterTest
File
- tests/
src/ Unit/ Adapter/ TamperableComplexDataAdapterTest.php, line 13
Namespace
Drupal\Tests\tamper\Unit\AdapterView source
class TamperableComplexDataAdapterTest extends UnitTestCase {
/**
* Complex data object.
*
* @var \Drupal\Core\TypedData\ComplexDataInterface|\PHPUnit_Framework_MockObject_MockObject
*/
protected $complexData;
/**
* Adapter for the complex data.
*
* @var \Drupal\tamper\Adapter\TamperableComplexDataAdapter
*/
protected $adapter;
/**
* {@inheritdoc}
*/
protected function setUp() {
$this->complexData = $this
->createMock(ComplexDataInterface::class);
$this->adapter = new TamperableComplexDataAdapter($this->complexData);
}
/**
* @covers ::getSource
*/
public function testGetSource() {
$this->complexData
->expects($this
->once())
->method('toArray');
$this->adapter
->getSource();
}
/**
* @covers ::getSourceProperty
*/
public function testGetSourceProperty() {
$this->complexData
->expects($this
->once())
->method('get')
->with('foo');
$this->adapter
->getSourceProperty('foo');
}
/**
* @covers ::setSourceProperty
*/
public function testSetSourceProperty() {
$this->complexData
->expects($this
->once())
->method('set')
->with('foo', 'bar');
$this->adapter
->setSourceProperty('foo', 'bar');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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. | |
TamperableComplexDataAdapterTest:: |
protected | property | Adapter for the complex data. | |
TamperableComplexDataAdapterTest:: |
protected | property | Complex data object. | |
TamperableComplexDataAdapterTest:: |
protected | function |
Overrides UnitTestCase:: |
|
TamperableComplexDataAdapterTest:: |
public | function | @covers ::getSource | |
TamperableComplexDataAdapterTest:: |
public | function | @covers ::getSourceProperty | |
TamperableComplexDataAdapterTest:: |
public | function | @covers ::setSourceProperty | |
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. |