Attribute-mapped Active Record ORM for MariaDB/MySQL over PDO. - Attribute-driven metadata: TableName, PrimaryKey, AutoIncrement, Column, Guarded, Ignore, Required, Enum, Nullable, Length, Precision, Unique, UniqueGroup, Index, MaxLength. - Relationship mapping: BelongsTo, HasOne, HasMany, BelongsToMany with batched eager loading and a 3-level depth limit. - Orm entry point with fromArray, fromPdo, fromEnv and nested transactions. - Immutable Query with Cond operators and GroupCond grouping. - Repository read and write API, pagination, and typed exception hierarchy. - Declares PHP >=8.3; Mago and PHPStan pin the parser to 8.3. - MIT license.
34 lines
976 B
PHP
34 lines
976 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Camelia\Orm\Tests\Unit\Support;
|
|
|
|
use Camelia\Orm\Support\NameConverter;
|
|
use PHPUnit\Framework\Attributes\Test;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
final class NameConverterTest extends TestCase
|
|
{
|
|
#[Test]
|
|
public function it_converts_internal_capitals_to_underscores(): void
|
|
{
|
|
self::assertSame('codigo_empresa', NameConverter::camelToSnake('codigoEmpresa'));
|
|
self::assertSame('id_zona', NameConverter::camelToSnake('idZona'));
|
|
self::assertSame('normal', NameConverter::camelToSnake('normal'));
|
|
self::assertSame('', NameConverter::camelToSnake(''));
|
|
}
|
|
|
|
#[Test]
|
|
public function it_never_prefixes_the_first_character(): void
|
|
{
|
|
self::assertSame('nombre', NameConverter::camelToSnake('Nombre'));
|
|
}
|
|
|
|
#[Test]
|
|
public function it_round_trips_simple_names(): void
|
|
{
|
|
self::assertSame('codigoEmpresa', NameConverter::snakeToCamel('codigo_empresa'));
|
|
}
|
|
}
|