-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#13297] - Added test with fractal fields
- Loading branch information
Showing
1 changed file
with
39 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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( | ||
|
@@ -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); | ||
} | ||
} |