Browse Source

Add integration test for #5267

Mark Story 11 years ago
parent
commit
fa9b7f8efe
1 changed files with 14 additions and 0 deletions
  1. 14 0
      tests/TestCase/ORM/QueryRegressionTest.php

+ 14 - 0
tests/TestCase/ORM/QueryRegressionTest.php

@@ -535,4 +535,18 @@ class QueryRegressionTest extends TestCase {
 		$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);
+	}
+
 }