-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Index and databese id's dont match #35
Comments
@cebe whats the plan now? Can I make the change or is it best to wait until the status is labelled "status:ready for adoption". Not sure on the workflow. |
@AdeAttwood could you come up with a unit test that shows the problem? |
@cube I have come up with this test. I did have an issue building the docker image, so I have run all the tests in a modified public function testIndexMatchesPrimaryKey()
{
$userTable = [
'user_id' => 'pk',
'username' => 'string',
'email' => 'string',
'auth_key' => 'string',
'password' => 'string',
'created_at' => 'integer',
'updated_at' => 'integer'
];
Yii::$app->db->createCommand()->createTable('user', $userTable)->execute();
$this->_fixtureController->actionGenerate('user');
$fixtureData = require Yii::getAlias('@runtime/faker/user.php');
array_shift($userTable);
Yii::$app->db->createCommand()->batchInsert('user', array_keys($userTable), $fixtureData)->execute();
$rows = Yii::$app->db->createCommand('SELECT * FROM user')->queryAll();
foreach ($rows as $row) {
$validatePassword = Yii::$app->security->validatePassword('password_'.$row['user_id'], $row['password']);
$this->assertTrue($validatePassword);
}
} I had to add new $appClass(ArrayHelper::merge([
'id' => 'testapp',
'basePath' => __DIR__,
'vendorPath' => dirname(__DIR__) . '/vendor',
'components' => [
'db' => [
'class' => '\yii\db\Connection',
'dsn' => 'sqlite::memory:',
],
],
], $config)); It did break one of the tests with |
Is anyone else having an issue with
$index
not being the same as the record id?Because my database id's start at 1 and the index being passed into the faker template starts at 0 the record id does not match the index.
if in the loop was
for ($i = 1; $i <= $this->count; $i++) {
The index and the record id would be the same.The text was updated successfully, but these errors were encountered: