ExceptionConverterTest.php 2.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
<?php

declare(strict_types=1);

namespace Doctrine\DBAL\Tests\Driver\API\OCI;

use Doctrine\DBAL\Driver\API\ExceptionConverter as ExceptionConverterInterface;
use Doctrine\DBAL\Driver\API\OCI\ExceptionConverter;
use Doctrine\DBAL\Exception\ConnectionException;
use Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException;
use Doctrine\DBAL\Exception\InvalidFieldNameException;
use Doctrine\DBAL\Exception\NonUniqueFieldNameException;
use Doctrine\DBAL\Exception\NotNullConstraintViolationException;
use Doctrine\DBAL\Exception\SyntaxErrorException;
use Doctrine\DBAL\Exception\TableExistsException;
use Doctrine\DBAL\Exception\TableNotFoundException;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\DBAL\Tests\Driver\API\ExceptionConverterTest as BaseExceptionConverterTest;

final class ExceptionConverterTest extends BaseExceptionConverterTest
{
    protected function createConverter(): ExceptionConverterInterface
    {
        return new ExceptionConverter();
    }

    /**
     * {@inheritDoc}
     */
    protected static function getExceptionConversionData(): array
    {
        return [
            ConnectionException::class => [
                [1017],
                [12545],
            ],
            ForeignKeyConstraintViolationException::class => [
                [2292],
            ],
            InvalidFieldNameException::class => [
                [904],
            ],
            NonUniqueFieldNameException::class => [
                [918],
                [960],
            ],
            NotNullConstraintViolationException::class => [
                [1400],
            ],
            SyntaxErrorException::class => [
                [923],
            ],
            TableExistsException::class => [
                [955],
            ],
            TableNotFoundException::class => [
                [942],
            ],
            UniqueConstraintViolationException::class => [
                [1],
                [2299],
                [38911],
            ],
        ];
    }
}