function ResourceResponseValidatorTest::setUp
Overrides UnitTestCase::setUp
File
- 
              core/
modules/ jsonapi/ tests/ src/ Unit/ EventSubscriber/ ResourceResponseValidatorTest.php, line 36  
Class
- ResourceResponseValidatorTest
 - @coversDefaultClass \Drupal\jsonapi\EventSubscriber\ResourceResponseValidator[[api-linebreak]] @group jsonapi
 
Namespace
Drupal\Tests\jsonapi\Unit\EventSubscriberCode
protected function setUp() : void {
  parent::setUp();
  // Check that the validation class is available.
  if (!class_exists("\\JsonSchema\\Validator")) {
    $this->fail('The JSON Schema validator is missing. You can install it with `composer require justinrainbow/json-schema`.');
  }
  $module_handler = $this->prophesize(ModuleHandlerInterface::class);
  $module = $this->prophesize(Extension::class);
  $module_path = dirname(__DIR__, 4);
  $module->getPath()
    ->willReturn($module_path);
  $module_handler->getModule('jsonapi')
    ->willReturn($module->reveal());
  $subscriber = new ResourceResponseValidator($this->prophesize(LoggerInterface::class)
    ->reveal(), $module_handler->reveal(), '');
  $subscriber->setValidator();
  $this->subscriber = $subscriber;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.