JsonApiGeneratorTest.php in OpenAPI 8
File
tests/src/Kernel/JsonApiGeneratorTest.php
View source
<?php
namespace Drupal\Tests\openapi\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\openapi_test\Entity\OpenApiTestEntityType;
class JsonApiGeneratorTest extends KernelTestBase {
protected static $modules = [
'field',
'jsonapi',
'link',
'menu_link_content',
'menu_ui',
'openapi',
'openapi_test',
'schemata',
'schemata_json_schema',
'serialization',
'system',
'user',
];
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('openapi_test_entity');
OpenApiTestEntityType::create([
'id' => 'test',
'label' => 'Test',
])
->save();
}
public function testGetPaths() {
$field_definitions = $this->container
->get('entity_field.manager')
->getFieldDefinitions('openapi_test_entity', 'test');
$this
->assertArrayHasKey('menu_link', $field_definitions);
$this->container
->get('plugin.manager.openapi.generator')
->createInstance('jsonapi')
->getPaths();
}
}