Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 18 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| Lti1p3RegistrationSnapshotSchemaProvider | |
0.00% |
0 / 18 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| provideSchema | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2022 (original work) Open Assessment Technologies SA; |
| 19 | * |
| 20 | * @author Sergei Mikhailov <sergei.mikhailov@taotesting.com> |
| 21 | */ |
| 22 | |
| 23 | declare(strict_types=1); |
| 24 | |
| 25 | namespace oat\taoLti\models\classes\Platform\Repository; |
| 26 | |
| 27 | use Doctrine\DBAL\Types\Types; |
| 28 | use oat\generis\persistence\sql\SchemaCollection; |
| 29 | use oat\generis\persistence\sql\SchemaProviderInterface; |
| 30 | |
| 31 | class Lti1p3RegistrationSnapshotSchemaProvider implements SchemaProviderInterface |
| 32 | { |
| 33 | /** @var string */ |
| 34 | private $connectionId; |
| 35 | |
| 36 | public function __construct(string $connectionId = 'default') |
| 37 | { |
| 38 | $this->connectionId = $connectionId; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @inheritDoc |
| 43 | */ |
| 44 | public function provideSchema(SchemaCollection $schemaCollection): void |
| 45 | { |
| 46 | $schema = $schemaCollection->getSchema($this->connectionId); |
| 47 | |
| 48 | $table = $schema->createTable('lti_platform_registration'); |
| 49 | |
| 50 | $table->addOption('engine', 'InnoDb'); |
| 51 | |
| 52 | $table->addColumn('id', Types::INTEGER, ['unsigned' => true, 'autoincrement' => true, 'notnull' => true]); |
| 53 | $table->addColumn('statement_id', Types::STRING, ['length' => 255, 'notnull' => true]); |
| 54 | $table->addColumn('name', Types::STRING, ['length' => 255, 'notnull' => true]); |
| 55 | $table->addColumn('audience', Types::STRING, ['length' => 255, 'notnull' => true]); |
| 56 | $table->addColumn('client_id', Types::STRING, ['length' => 255, 'notnull' => true]); |
| 57 | $table->addColumn('deployment_id', Types::STRING, ['length' => 255, 'notnull' => true]); |
| 58 | $table->addColumn('oidc_authentication_url', Types::STRING, ['length' => 255, 'notnull' => true]); |
| 59 | $table->addColumn('oauth2_access_token_url', Types::STRING, ['length' => 255, 'notnull' => true]); |
| 60 | $table->addColumn('jwks_url', Types::STRING, ['length' => 255, 'notnull' => true]); |
| 61 | $table->addColumn('updated_at', Types::DATETIME_MUTABLE, ['notnull' => true]); |
| 62 | |
| 63 | $table->setPrimaryKey(['id']); |
| 64 | $table->addIndex(['audience', 'client_id'], "IDX_audience_client_id"); |
| 65 | $table->addIndex(['client_id'], "IDX_client_id"); |
| 66 | $table->addUniqueIndex(['statement_id'], 'UNQ_statement_id'); |
| 67 | } |
| 68 | } |