Skip to content

Commit

Permalink
[#13002] - Adding different model
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed May 15, 2019
1 parent eca0c98 commit 3a2be1b
Showing 1 changed file with 18 additions and 26 deletions.
44 changes: 18 additions & 26 deletions tests/integration/Mvc/Model/SaveCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,28 +278,24 @@ public function mvcModelSaveCastLastInsertIdDefault(IntegrationTester $I, Exampl
$method = $function[0];
$this->$method();

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

$name = uniqid();
$test = new Prueba();
$test->nombre = $name;
$test->estado = 'A';
$user = new Users();
$user->name = 'New User';
$I->assertTrue($user->save());

$result = $test->save();
$newId = $user->id;
$result = $user->delete();
$I->assertTrue($result);

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

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

$result = $test->delete();
$I->assertTrue($result);
$expected = intval($newId, 10);
$I->assertEquals($expected, $newId);
}

/**
Expand All @@ -317,28 +313,24 @@ public function mvcModelSaveCastLastInsertIdInt(IntegrationTester $I, Example $f
$method = $function[1];
$this->$method();

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

$name = uniqid();
$test = new Prueba();
$test->nombre = $name;
$test->estado = 'A';
$user = new Users();
$user->name = 'New User';
$I->assertTrue($user->save());

$result = $test->save();
$newId = $user->id;
$result = $user->delete();
$I->assertTrue($result);

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

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

$result = $test->delete();
$I->assertTrue($result);
$expected = intval($newId, 10);
$I->assertEquals($expected, $newId);
}

/**
Expand Down

0 comments on commit 3a2be1b

Please sign in to comment.