1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-12 17:14:16 +02:00

PascalCase constants

This commit is contained in:
David Grudl
2024-05-10 15:44:51 +02:00
parent 490cf143ba
commit d707b4ba0e
16 changed files with 119 additions and 70 deletions

View File

@@ -74,7 +74,7 @@ Assert::same(
(string) $fluent,
);
$fluent->orderBy(Dibi\Fluent::REMOVE);
$fluent->orderBy(Dibi\Fluent::Remove);
Assert::same(
reformat('SELECT * , [a] , [b] AS [bAlias] , [c], [d], [e] , [d] FROM [anotherTable] AS [anotherAlias] INNER JOIN [table3] ON table.col = table3.col WHERE col > 10 OR col < 5 AND active = 1 AND [col] IN (1, 2, 3)'),

View File

@@ -27,8 +27,8 @@ class MockResult extends Dibi\Result
test('', function () {
$result = new MockResult;
$result->setType('col', Type::TEXT);
$result->setFormat(Type::TEXT, 'native');
$result->setType('col', Type::Text);
$result->setFormat(Type::Text, 'native');
Assert::same(['col' => null], $result->test(['col' => null]));
Assert::same(['col' => true], $result->test(['col' => true]));
@@ -38,7 +38,7 @@ test('', function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::BOOL);
$result->setType('col', Type::Bool);
Assert::same(['col' => null], $result->test(['col' => null]));
Assert::same(['col' => true], $result->test(['col' => true]));
@@ -60,7 +60,7 @@ test('', function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::TEXT);
$result->setType('col', Type::Text);
Assert::same(['col' => null], $result->test(['col' => null]));
Assert::same(['col' => '1'], $result->test(['col' => true]));
@@ -76,7 +76,7 @@ test('', function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::FLOAT);
$result->setType('col', Type::Float);
Assert::same(['col' => null], $result->test(['col' => null]));
Assert::same(['col' => 1.0], $result->test(['col' => true]));
@@ -153,7 +153,7 @@ test('', function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::INTEGER);
$result->setType('col', Type::Integer);
Assert::same(['col' => null], $result->test(['col' => null]));
Assert::same(['col' => 1], $result->test(['col' => true]));
@@ -187,7 +187,7 @@ test('', function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::DATETIME);
$result->setType('col', Type::DateTime);
Assert::same(['col' => null], $result->test(['col' => null]));
Assert::exception(
@@ -206,8 +206,8 @@ test('', function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::DATETIME);
$result->setFormat(Type::DATETIME, 'Y-m-d H:i:s');
$result->setType('col', Type::DateTime);
$result->setFormat(Type::DateTime, 'Y-m-d H:i:s');
Assert::same(['col' => null], $result->test(['col' => null]));
Assert::exception(
@@ -226,7 +226,7 @@ test('', function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::DATE);
$result->setType('col', Type::Date);
Assert::same(['col' => null], $result->test(['col' => null]));
Assert::exception(
@@ -243,7 +243,7 @@ test('', function () {
test('', function () {
$result = new MockResult;
$result->setType('col', Type::TIME);
$result->setType('col', Type::Time);
Assert::same(['col' => null], $result->test(['col' => null]));
Assert::exception(

View File

@@ -12,7 +12,7 @@ $conn->loadFile(__DIR__ . "/data/$config[system].sql");
$res = $conn->query('SELECT * FROM [customers]');
// auto-converts this column to integer
$res->setType('customer_id', Dibi\Type::DATETIME);
$res->setType('customer_id', Dibi\Type::DateTime);
Assert::equal(new Dibi\Row([
'customer_id' => new Dibi\DateTime('1970-01-01 01:00:01'),