From fa9b7f8efe8e81a8d5a754c7e5eaf5f32ce31af0 Mon Sep 17 00:00:00 2001 From: Mark Story Date: Mon, 1 Dec 2014 21:27:58 -0500 Subject: [PATCH] Add integration test for #5267 --- tests/TestCase/ORM/QueryRegressionTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/TestCase/ORM/QueryRegressionTest.php b/tests/TestCase/ORM/QueryRegressionTest.php index f9e9c60f726..5210f023e25 100644 --- a/tests/TestCase/ORM/QueryRegressionTest.php +++ b/tests/TestCase/ORM/QueryRegressionTest.php @@ -535,4 +535,18 @@ public function testCountWithUnionQuery() { $this->assertEquals(2, $query->count()); } +/** + * Integration test when selecting no fields on the primary table. + * + * @return void + */ + public function testSelectNoFieldsOnPrimaryAlias() { + $table = TableRegistry::get('Articles'); + $table->belongsTo('Users'); + $query = $table->find() + ->select(['Users__id' => 'id']); + $results = $query->toArray(); + $this->assertCount(3, $results); + } + }