UnitTestBase.php in Feeds extensible parsers 8
File
tests/src/Unit/UnitTestBase.php
View source
<?php
namespace Drupal\Tests\feeds_ex\Unit;
use ReflectionMethod;
use Drupal\Tests\feeds\Unit\FeedsUnitTestCase;
abstract class UnitTestBase extends FeedsUnitTestCase {
protected $moduleDir;
protected $fileSystem;
public function setUp() {
$this->moduleDir = dirname(dirname(dirname(dirname(__FILE__))));
parent::setUp();
$this->fileSystem = $this
->getMockFileSystem();
}
protected function invokeMethod($object, $method, array $arguments = []) {
$reflector = new ReflectionMethod($object, $method);
$reflector
->setAccessible(TRUE);
return $reflector
->invokeArgs($object, $arguments);
}
protected function assertEmptyFeedMessage(array $messages) {
$this
->assertCount(1, $messages, strtr('There is one message (actual: @actual).', [
'@actual' => count($messages),
]));
$this
->assertSame((string) $messages[0]['message'], 'The feed is empty.', 'Message text is correct.');
$this
->assertSame($messages[0]['type'], 'warning', 'Message type is warning.');
$this
->assertFalse($messages[0]['repeat'], 'Repeat is set to false.');
}
}