Skip to content

Commit

Permalink
Merge pull request #16368 from phalcon/#16307-add-test-case
Browse files Browse the repository at this point in the history
#16307 - Add test case
  • Loading branch information
Jeckerson authored Jul 1, 2023
2 parents 8454d87 + d68a2b2 commit bd9adbd
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 35 deletions.
48 changes: 24 additions & 24 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/phalcon/di/injectable.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ext/phalcon/encryption/crypt.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions ext/phalcon/storage/adapter/stream.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ext/phalcon/storage/serializer/json.zep.c

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions tests/database/Mvc/Model/FindCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,41 @@ public function mvcModelFindPrivatePropertyWithRedisCache(DatabaseTester $I)
$result = $cache->delete($cacheKey);
$I->assertTrue($result);
}

/**
* Tests Phalcon\Mvc\Model :: find() - specific column
*
* @author Phalcon Team <[email protected]>
* @since 2023-06-30
*
* @group mysql
* @group pgsql
* @group sqlite
*/
public function mvcModelFindWithSpecificColumn(DatabaseTester $I)
{
$I->wantToTest('Mvc\Model - find() - with specific column');

/** @var PDO $connection */
$connection = $I->getConnection();
$migration = new ObjectsMigration($connection);
$migration->insert(1, 'random data', 1);
$migration->insert(2, 'random data 2', 1);
$migration->insert(4, 'random data 4', 1);

/**
* Get the records (should cache the resultset)
*/
$data = Objects::find(
[
'columns' => 'obj_id',
'conditions' => 'obj_id IN ({ids:array})',
'bind' => ['ids' => [1, 2, 3]],
]
);

$I->assertEquals(2, count($data));
$I->assertEquals(1, $data[0]->obj_id);
$I->assertEquals(2, $data[1]->obj_id);
}
}
4 changes: 1 addition & 3 deletions tests/database/Mvc/Model/UnderscoreSetCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,9 +401,7 @@ public function mvcModelUnderscoreSetWithHasManyRelatedRecords(DatabaseTester $I
new Models\Invoices()
];

$I->assertTrue(
$customer->save()
);
$I->assertTrue($customer->save());

$I->assertCount(
2,
Expand Down

0 comments on commit bd9adbd

Please sign in to comment.