-
-
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.
Browse files
Browse the repository at this point in the history
#16307 - Add test case
- Loading branch information
Showing
7 changed files
with
70 additions
and
35 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -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); | ||
} | ||
} |
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