Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7e8a788
[#481] Normalize enum and trivial exception coverage annotations
armanist Apr 29, 2026
4f096e7
[#481] Add App exception factory coverage tests
armanist Apr 29, 2026
eb38106
[#481] Add Archive exception factory coverage tests
armanist Apr 29, 2026
abbb942
[#481] Add Asset exception factory coverage tests
armanist Apr 29, 2026
732bd5f
[#481] Add Auth exception factory coverage tests
armanist Apr 29, 2026
16c4549
[#481] Add Config exception factory coverage tests
armanist Apr 29, 2026
8bff370
[#481] Align exception tests with source folder structure
armanist Apr 29, 2026
763a687
[#481] Add Csrf exception factory coverage tests
armanist Apr 29, 2026
8b83dfe
[#481] Add Database exception factory coverage tests
armanist Apr 29, 2026
00f2b30
[#481] Add Di exception factory coverage tests
armanist Apr 29, 2026
e30bb61
[#481] Add Encryption exception factory coverage tests
armanist Apr 29, 2026
23ac19c
[#481] Add Environment exception factory coverage tests
armanist Apr 29, 2026
fe637cf
[#481] Add Hasher exception factory coverage tests
armanist Apr 29, 2026
74583d9
[#481] Add Hook exception factory coverage tests
armanist Apr 29, 2026
2399500
[#481] Add HttpClient exception factory coverage tests
armanist Apr 29, 2026
d665761
[#481] Add Jwt exception factory coverage tests
armanist Apr 29, 2026
61206d1
[#481] Add Lang exception factory coverage tests
armanist Apr 29, 2026
dd89383
[#481] Add Logger exception factory coverage tests
armanist Apr 29, 2026
0ac782a
[#481] Add Middleware exception factory coverage tests
armanist Apr 29, 2026
c655a83
[#481] Add Migration exception factory coverage tests
armanist Apr 29, 2026
87d63ba
[#481] Add Model exception factory coverage tests
armanist Apr 29, 2026
32c5941
[#481] Add Module exception factory coverage tests
armanist Apr 29, 2026
aa4145e
[#481] Add Paginator exception factory coverage tests
armanist Apr 29, 2026
85b53c2
[#481] Add Router exception factory coverage tests
armanist Apr 29, 2026
a27e733
[#481] Add Session exception factory coverage tests
armanist Apr 29, 2026
5b1b056
[#481] Add Storage exception factory coverage tests
armanist Apr 29, 2026
8bd7838
[#481] Add View exception factory coverage tests
armanist Apr 29, 2026
f0243f7
[#481] CS fixes
armanist Apr 29, 2026
6efc846
Fix CaptchaException docblock and RouteException code assertions
armanist Apr 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Auth/Enums/AuthKeys.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
/**
* Class AuthKeys
* @package Quantum\Auth
* @codeCoverageIgnore
*/
class AuthKeys
final class AuthKeys
{
/**
* One time password key
Expand Down Expand Up @@ -71,4 +72,8 @@ class AuthKeys
* Remember token key
*/
public const REMEMBER_TOKEN = 'rememberToken';

private function __construct()
{
}
}
1 change: 1 addition & 0 deletions src/Cache/Exceptions/CacheException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/**
* Class CacheException
* @package Quantum\Cache
* @codeCoverageIgnore
*/
class CacheException extends BaseException
{
Expand Down
3 changes: 2 additions & 1 deletion src/Captcha/Exceptions/CaptchaException.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
use Quantum\App\Exceptions\BaseException;

/**
* Class CacheException
* Class CaptchaException
* @package Quantum\Captcha
* @codeCoverageIgnore
Comment thread
armanist marked this conversation as resolved.
*/
class CaptchaException extends BaseException
{
Expand Down
5 changes: 5 additions & 0 deletions src/Cron/Enums/ExceptionMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/**
* Enum ExceptionMessages
* @package Quantum\Cron
* @codeCoverageIgnore
*/
final class ExceptionMessages
{
Expand All @@ -29,4 +30,8 @@ final class ExceptionMessages
public const INVALID_TASK_FILE = 'Invalid task file "%s": must return array or CronTask instance';
public const CRON_DIRECTORY_NOT_FOUND = 'Cron directory not found: %s';
public const LOCK_DIRECTORY_NOT_WRITABLE = 'Lock directory is not writable: %s';

private function __construct()
{
}
}
6 changes: 5 additions & 1 deletion src/Database/Enums/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
/**
* Class Key
* @package Quantum\Database
* @codeCoverageIgnore
*/
class Key
final class Key
{
/**
* Primary key definition
Expand All @@ -47,4 +48,7 @@ class Key
*/
public const SPATIAL = 'spatial';

private function __construct()
{
}
}
7 changes: 6 additions & 1 deletion src/Database/Enums/Relation.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@
/**
* Class Relation
* @package Quantum\Database
* @codeCoverageIgnore
*/
class Relation
final class Relation
{
public const HAS_ONE = 'hasOne';
public const HAS_MANY = 'hasMany';
public const BELONGS_TO = 'belongsTo';
public const BELONGS_TO_MANY = 'belongsToMany';

private function __construct()
{
}
}
6 changes: 5 additions & 1 deletion src/Database/Enums/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
/**
* Class Type
* @package Quantum\Database
* @codeCoverageIgnore
*/
class Type
final class Type
{
/**
* Type integer
Expand Down Expand Up @@ -107,4 +108,7 @@ class Type
*/
public const GEOMETRY = 'geometry';

private function __construct()
{
}
}
5 changes: 5 additions & 0 deletions src/Environment/Enums/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/**
* Class Env
* @package Quantum\Environment
* @codeCoverageIgnore
*/
final class Env
{
Expand Down Expand Up @@ -46,4 +47,8 @@ final class Env
* Local environment - developer's local machine environment.
*/
public const LOCAL = 'local';

private function __construct()
{
}
}
5 changes: 5 additions & 0 deletions src/Http/Enums/ContentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/**
* Class ContentType
* @package Quantum\Http
* @codeCoverageIgnore
*/
final class ContentType
{
Expand Down Expand Up @@ -56,4 +57,8 @@ final class ContentType
* Default content type for binary streams
*/
public const OCTET_STREAM = 'application/octet-stream';

private function __construct()
{
}
}
5 changes: 5 additions & 0 deletions src/Http/Enums/StatusCode.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
/**
* Class StatusCode
* @package Quantum\Http
* @codeCoverageIgnore
*/
final class StatusCode
{
Expand Down Expand Up @@ -88,4 +89,8 @@ final class StatusCode
public const LOOP_DETECTED = 508;
public const NOT_EXTENDED = 510;
public const NETWORK_AUTHENTICATION_REQUIRED = 511;

private function __construct()
{
}
}
1 change: 1 addition & 0 deletions src/Http/Exceptions/HttpException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/**
* Class HttpException
* @package Quantum\Http
* @codeCoverageIgnore
*/
class HttpException extends BaseException
{
Expand Down
1 change: 1 addition & 0 deletions src/Loader/Exceptions/LoaderException.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*
* @package Quantum
* @category Exceptions
* @codeCoverageIgnore
*/
class LoaderException extends BaseException
{
Expand Down
1 change: 1 addition & 0 deletions src/Mailer/Exceptions/MailerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/**
* Class MailerException
* @package Quantum\Mailer
* @codeCoverageIgnore
*/
class MailerException extends BaseException
{
Expand Down
7 changes: 6 additions & 1 deletion src/Paginator/Enums/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
/**
* Class Pagination
* @package Quantum\Paginator
* @codeCoverageIgnore
*/
class Pagination
final class Pagination
{
/**
* Pagination class name
Expand Down Expand Up @@ -56,4 +57,8 @@ class Pagination
* Edge padding
*/
public const EDGE_PADDING = 3;

private function __construct()
{
}
}
1 change: 1 addition & 0 deletions src/Renderer/Exceptions/RendererException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/**
* Class RendererException
* @package Quantum\Renderer
* @codeCoverageIgnore
*/
class RendererException extends BaseException
{
Expand Down
1 change: 1 addition & 0 deletions src/ResourceCache/Exceptions/ResourceCacheException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/**
* Class ResourceCacheException
* @package Quantum\ResourceCache
* @codeCoverageIgnore
*/
class ResourceCacheException extends BaseException
{
Expand Down
1 change: 1 addition & 0 deletions src/Service/Exceptions/ServiceException.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
/**
* Class ServiceException
* @package Quantum\Service
* @codeCoverageIgnore
*/
class ServiceException extends BaseException
{
Expand Down
18 changes: 18 additions & 0 deletions tests/Unit/App/Exceptions/AppExceptionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

namespace Quantum\Tests\Unit\App\Exceptions;

use Quantum\App\Exceptions\AppException;
use Quantum\Tests\Unit\AppTestCase;

class AppExceptionTest extends AppTestCase
{
public function testMissingAppKeyFactory(): void
{
$exception = AppException::missingAppKey();

$this->assertInstanceOf(AppException::class, $exception);
$this->assertSame('APP KEY is missing.', $exception->getMessage());
$this->assertSame(E_ERROR, $exception->getCode());
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
61 changes: 61 additions & 0 deletions tests/Unit/App/Exceptions/BaseExceptionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?php

namespace Quantum\Tests\Unit\App\Exceptions;

use Quantum\App\Exceptions\BaseException;
use Quantum\Tests\Unit\AppTestCase;

class BaseExceptionStub extends BaseException
{
}

class BaseExceptionTest extends AppTestCase
{
public function testMethodNotSupportedFactory(): void
{
$exception = BaseExceptionStub::methodNotSupported('foo', 'Bar');

$this->assertInstanceOf(BaseExceptionStub::class, $exception);
$this->assertSame('The method `foo` is not supported for `Bar`.', $exception->getMessage());
$this->assertSame(E_WARNING, $exception->getCode());
}

public function testAdapterAndDriverFactories(): void
{
$adapterException = BaseExceptionStub::adapterNotSupported('x');
$driverException = BaseExceptionStub::driverNotSupported('y');

$this->assertSame('The adapter `x` is not supported.', $adapterException->getMessage());
$this->assertSame(E_ERROR, $adapterException->getCode());
$this->assertSame('The driver `y` is not supported.', $driverException->getMessage());
$this->assertSame(E_ERROR, $driverException->getCode());
}

public function testLookupAndConnectionFactories(): void
{
$fileException = BaseExceptionStub::fileNotFound('a.php');
$notFoundException = BaseExceptionStub::notFound('Route', 'home');
$instanceException = BaseExceptionStub::notInstanceOf('Foo', 'Bar');
$connectException = BaseExceptionStub::cantConnect('redis');

$this->assertSame('The file `a.php` not found.', $fileException->getMessage());
$this->assertSame(E_ERROR, $fileException->getCode());
$this->assertSame('Route `home` not found.', $notFoundException->getMessage());
$this->assertSame(E_ERROR, $notFoundException->getCode());
$this->assertSame('The `Foo` is not instance of `Bar`.', $instanceException->getMessage());
$this->assertSame(E_ERROR, $instanceException->getCode());
$this->assertSame('Can not connect to `redis`.', $connectException->getMessage());
$this->assertSame(E_ERROR, $connectException->getCode());
}

public function testConfigAndRequestMethodFactories(): void
{
$configException = BaseExceptionStub::missingConfig('database');
$methodException = BaseExceptionStub::requestMethodNotAvailable('PATCH');

$this->assertSame('Could not load config `database` properly.', $configException->getMessage());
$this->assertSame(E_ERROR, $configException->getCode());
$this->assertSame('Provided request method `PATCH` is not available.', $methodException->getMessage());
$this->assertSame(E_WARNING, $methodException->getCode());
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
27 changes: 27 additions & 0 deletions tests/Unit/Archive/Exceptions/ArchiveExceptionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Quantum\Tests\Unit\Archive\Exceptions;

use Quantum\Archive\Exceptions\ArchiveException;
use Quantum\Tests\Unit\AppTestCase;

class ArchiveExceptionTest extends AppTestCase
{
public function testCantOpen(): void
{
$exception = ArchiveException::cantOpen('demo.zip');

$this->assertInstanceOf(ArchiveException::class, $exception);
$this->assertSame('The archive `demo.zip` can not be opened', $exception->getMessage());
$this->assertSame(E_WARNING, $exception->getCode());
}

public function testMissingArchiveName(): void
{
$exception = ArchiveException::missingArchiveName();

$this->assertInstanceOf(ArchiveException::class, $exception);
$this->assertSame('Archive name is not set', $exception->getMessage());
$this->assertSame(E_WARNING, $exception->getCode());
}
}
27 changes: 27 additions & 0 deletions tests/Unit/Asset/Exceptions/AssetExceptionTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Quantum\Tests\Unit\Asset\Exceptions;

use Quantum\Asset\Exceptions\AssetException;
use Quantum\Tests\Unit\AppTestCase;

class AssetExceptionTest extends AppTestCase
{
public function testPositionInUse(): void
{
$exception = AssetException::positionInUse(7, 'styles.css');

$this->assertInstanceOf(AssetException::class, $exception);
$this->assertSame('Position `7` for asset `styles.css` is in use', $exception->getMessage());
$this->assertSame(E_WARNING, $exception->getCode());
}

public function testNameInUse(): void
{
$exception = AssetException::nameInUse('main-style');

$this->assertInstanceOf(AssetException::class, $exception);
$this->assertSame('The name main-style is in use', $exception->getMessage());
$this->assertSame(E_WARNING, $exception->getCode());
}
}
Comment thread
armanist marked this conversation as resolved.
Loading
Loading