Skip to content

Commit

Permalink
[#13297] - Added test with fractal fields
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Feb 4, 2020
1 parent 963584a commit 3e8a21c
Showing 1 changed file with 39 additions and 8 deletions.
47 changes: 39 additions & 8 deletions tests/database/Db/Column/GetScaleCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,33 @@

declare(strict_types=1);

namespace Phalcon\Test\Database\Db\Column;
namespace Phalcon\Test\Integration\Db\Column;

use DatabaseTester;
use Phalcon\Test\Fixtures\Traits\DbTrait;
use IntegrationTester;
use Phalcon\Db\Adapter\Pdo\Mysql as DbMysql;
use Phalcon\Db\Dialect\Mysql as DialectMysql;
use Phalcon\Test\Fixtures\Migrations\FractalDatesMigration;
use Phalcon\Test\Fixtures\Traits\Db\MysqlTrait;
use Phalcon\Test\Fixtures\Traits\DiTrait;
use Phalcon\Test\Models\FractalDates;

class GetScaleCest
{
use DbTrait;
use DiTrait;
use MysqlTrait;

/**
* Tests Phalcon\Db\Column :: getScale()
*
* @author Phalcon Team <[email protected]>
* @since 2020-02-01
* @since 2018-11-13
*/
public function dbColumnGetScale(DatabaseTester $I)
public function dbColumnGetScale(IntegrationTester $I)
{
$I->wantToTest("Db\Column - getScale()");

$columns = $this->getColumnsArray();
$expectedColumns = $this->getColumnsObjects();
$columns = $this->getColumns();
$expectedColumns = $this->getExpectedColumns();

foreach ($expectedColumns as $index => $column) {
$I->assertEquals(
Expand All @@ -40,4 +46,29 @@ public function dbColumnGetScale(DatabaseTester $I)
);
}
}

/**
* Tests Phalcon\Db\Column :: getScale() - datetime, time, timestamp
*
* @author Phalcon Team <[email protected]>
* @since 2019-12-23
*/
public function dbColumnGetScaleDateTimeTimeTimeStamp(IntegrationTester $I)
{
$I->wantToTest("Db\Column - getScale() - datetime, time, timestamp");

/**
* @todo this is for MySql
*/
/** @var DbMysql $db */
$db = $this->container->get('db');
(new FractalDatesMigration())($db);

$record = FractalDates::findFirst('id = 1');

$I->assertEquals(1, $record->id);
$I->assertEquals('14:15:16.44', $record->ftime);
$I->assertEquals('2019-12-25 17:18:19.67', $record->fdatetime);
$I->assertEquals('2019-12-25 20:21:22.89', $record->ftimestamp);
}
}

0 comments on commit 3e8a21c

Please sign in to comment.