Skip to content

Commit

Permalink
[#13002] - Trying to fix lock
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed May 15, 2019
1 parent 217e569 commit a95c4f9
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions tests/integration/Mvc/Model/SaveCest.php
Expand Up @@ -264,23 +264,23 @@ public function mvcModelSaveAfterUsingRelatedGetters(IntegrationTester $I)
}

/**
* Tests Phalcon\Mvc\Model :: save() - cast lastInsertId to int
* Tests Phalcon\Mvc\Model :: save() - cast lastInsertId to int - default
*
* @dataProvider getFunctions
*
* @author Phalcon Team <team@phalconphp.com>
* @since 2019-05-10
*/
public function mvcModelSaveCastLastInsertId(IntegrationTester $I, Example $function)
public function mvcModelSaveCastLastInsertIdDefault(IntegrationTester $I, Example $function)
{
$I->wantToTest('Mvc\Model - save() - cast lastInsertId to int');
$I->wantToTest('Mvc\Model - save() - cast lastInsertId to int default');

$method = $function[0];
$this->$method();

Prueba::setup(
[
'castLastInsertIdToInt' => true,
'castLastInsertIdToInt' => false,
]
);

Expand All @@ -293,17 +293,33 @@ public function mvcModelSaveCastLastInsertId(IntegrationTester $I, Example $func
$I->assertTrue($result);

$actual = $test->id;
$I->assertTrue(is_int($actual));
$I->assertTrue(is_string($actual));

$expected = intval($actual, 10);
$I->assertEquals($expected, $actual);

$result = $test->delete();
$I->assertTrue($result);
}

/**
* Tests Phalcon\Mvc\Model :: save() - cast lastInsertId to int
*
* @dataProvider getFunctions
*
* @author Phalcon Team <team@phalconphp.com>
* @since 2019-05-10
*/
public function mvcModelSaveCastLastInsertIdInt(IntegrationTester $I, Example $function)
{
$I->wantToTest('Mvc\Model - save() - cast lastInsertId to int');

$method = $function[0];
$this->$method();

Prueba::setup(
[
'castLastInsertIdToInt' => false,
'castLastInsertIdToInt' => true,
]
);

Expand All @@ -316,7 +332,7 @@ public function mvcModelSaveCastLastInsertId(IntegrationTester $I, Example $func
$I->assertTrue($result);

$actual = $test->id;
$I->assertTrue(is_string($actual));
$I->assertTrue(is_int($actual));

$expected = intval($actual, 10);
$I->assertEquals($expected, $actual);
Expand All @@ -326,13 +342,15 @@ public function mvcModelSaveCastLastInsertId(IntegrationTester $I, Example $func
}

/**
* Database providers
*
* @return array
*/
private function getFunctions(): array
{
return [
['setDiMysql'],
// ['setDiPostgresql'],
['setDiPostgresql'],
['setDiSqlite'],
];
}
Expand Down

0 comments on commit a95c4f9

Please sign in to comment.