public function TestRevisionHandler::testConstruct in Feeds Paragraphs 8
@covers ::__construct
File
- tests/
src/ Unit/ TestRevisionHandler.php, line 43
Class
- TestRevisionHandler
- @group Feeds Paragraphs @coversDefaultClass \Drupal\feeds_para_mapper\RevisionHandler
Namespace
Drupal\Tests\feeds_para_mapper\UnitCode
public function testConstruct() {
// Get mock, without the constructor being called
$mock = $this
->getMockBuilder(RevisionHandler::class)
->disableOriginalConstructor()
->getMock();
$reflectedClass = new \ReflectionClass(RevisionHandler::class);
$constructor = $reflectedClass
->getConstructor();
// Force the constructor to throw error:
// now call the constructor
$importer = $this
->prophesize(Importer::class);
$constructor
->invoke($mock, $this->messenger
->reveal(), $importer
->reveal());
$props = $reflectedClass
->getProperties();
$initialized = array(
'messenger',
'importer',
);
foreach ($props as $prop) {
if (in_array($prop
->getName(), $initialized)) {
$prop
->setAccessible(true);
$val = $prop
->getValue($mock);
self::assertNotEmpty($val);
}
}
}