Skip to content

Commit 40b9aae

Browse files
committed
Selects
1 parent 0ef44d8 commit 40b9aae

File tree

1 file changed

+47
-24
lines changed

1 file changed

+47
-24
lines changed

tests/e2e/Adapter/Base.php

Lines changed: 47 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8344,7 +8344,8 @@ public function testOneToOneTwoWayRelationship(): void
83448344

83458345
// Select related document attributes
83468346
$country = static::getDatabase()->findOne('country', [
8347-
Query::select(['*', 'city.name'])
8347+
Query::select('*'),
8348+
Query::select('city.name')
83488349
]);
83498350

83508351
if ($country->isEmpty()) {
@@ -8355,7 +8356,8 @@ public function testOneToOneTwoWayRelationship(): void
83558356
$this->assertArrayNotHasKey('code', $country->getAttribute('city'));
83568357

83578358
$country = static::getDatabase()->getDocument('country', 'country1', [
8358-
Query::select(['*', 'city.name'])
8359+
Query::select('*'),
8360+
Query::select('city.name')
83598361
]);
83608362

83618363
$this->assertEquals('London', $country->getAttribute('city')->getAttribute('name'));
@@ -8887,7 +8889,7 @@ public function testOneToManyOneWayRelationship(): void
88878889
]));
88888890

88898891
$documents = static::getDatabase()->find('artist', [
8890-
Query::select(['name']),
8892+
Query::select('name'),
88918893
Query::limit(1)
88928894
]);
88938895
$this->assertArrayNotHasKey('albums', $documents[0]);
@@ -8918,7 +8920,8 @@ public function testOneToManyOneWayRelationship(): void
89188920

89198921
// Select related document attributes
89208922
$artist = static::getDatabase()->findOne('artist', [
8921-
Query::select(['*', 'albums.name'])
8923+
Query::select('*'),
8924+
Query::select('albums.name')
89228925
]);
89238926

89248927
if ($artist->isEmpty()) {
@@ -8929,7 +8932,8 @@ public function testOneToManyOneWayRelationship(): void
89298932
$this->assertArrayNotHasKey('price', $artist->getAttribute('albums')[0]);
89308933

89318934
$artist = static::getDatabase()->getDocument('artist', 'artist1', [
8932-
Query::select(['*', 'albums.name'])
8935+
Query::select('*'),
8936+
Query::select('albums.name')
89338937
]);
89348938

89358939
$this->assertEquals('Album 1', $artist->getAttribute('albums')[0]->getAttribute('name'));
@@ -9351,7 +9355,8 @@ public function testOneToManyTwoWayRelationship(): void
93519355

93529356
// Select related document attributes
93539357
$customer = static::getDatabase()->findOne('customer', [
9354-
Query::select(['*', 'accounts.name'])
9358+
Query::select('*'),
9359+
Query::select('accounts.name')
93559360
]);
93569361

93579362
if ($customer->isEmpty()) {
@@ -9362,7 +9367,8 @@ public function testOneToManyTwoWayRelationship(): void
93629367
$this->assertArrayNotHasKey('number', $customer->getAttribute('accounts')[0]);
93639368

93649369
$customer = static::getDatabase()->getDocument('customer', 'customer1', [
9365-
Query::select(['*', 'accounts.name'])
9370+
Query::select('*'),
9371+
Query::select('accounts.name')
93669372
]);
93679373

93689374
$this->assertEquals('Account 1', $customer->getAttribute('accounts')[0]->getAttribute('name'));
@@ -9732,7 +9738,8 @@ public function testManyToOneOneWayRelationship(): void
97329738
$this->assertArrayNotHasKey('reviews', $movie);
97339739

97349740
$documents = static::getDatabase()->find('review', [
9735-
Query::select(['date', 'movie.date'])
9741+
Query::select('date'),
9742+
Query::select('movie.date')
97369743
]);
97379744

97389745
$this->assertCount(3, $documents);
@@ -9763,7 +9770,8 @@ public function testManyToOneOneWayRelationship(): void
97639770

97649771
// Select related document attributes
97659772
$review = static::getDatabase()->findOne('review', [
9766-
Query::select(['*', 'movie.name'])
9773+
Query::select('*'),
9774+
Query::select('movie.name')
97679775
]);
97689776

97699777
if ($review->isEmpty()) {
@@ -9774,7 +9782,8 @@ public function testManyToOneOneWayRelationship(): void
97749782
$this->assertArrayNotHasKey('length', $review->getAttribute('movie'));
97759783

97769784
$review = static::getDatabase()->getDocument('review', 'review1', [
9777-
Query::select(['*', 'movie.name'])
9785+
Query::select('*'),
9786+
Query::select('movie.name')
97789787
]);
97799788

97809789
$this->assertEquals('Movie 1', $review->getAttribute('movie')->getAttribute('name'));
@@ -10140,7 +10149,8 @@ public function testManyToOneTwoWayRelationship(): void
1014010149

1014110150
// Select related document attributes
1014210151
$product = static::getDatabase()->findOne('product', [
10143-
Query::select(['*', 'store.name'])
10152+
Query::select('*'),
10153+
Query::select('store.name')
1014410154
]);
1014510155

1014610156
if ($product->isEmpty()) {
@@ -10151,7 +10161,8 @@ public function testManyToOneTwoWayRelationship(): void
1015110161
$this->assertArrayNotHasKey('opensAt', $product->getAttribute('store'));
1015210162

1015310163
$product = static::getDatabase()->getDocument('product', 'product1', [
10154-
Query::select(['*', 'store.name'])
10164+
Query::select('*'),
10165+
Query::select('store.name')
1015510166
]);
1015610167

1015710168
$this->assertEquals('Store 1', $product->getAttribute('store')->getAttribute('name'));
@@ -10492,7 +10503,7 @@ public function testManyToManyOneWayRelationship(): void
1049210503
$this->assertEquals(1, \count($playlist1Document->getAttribute('songs')));
1049310504

1049410505
$documents = static::getDatabase()->find('playlist', [
10495-
Query::select(['name']),
10506+
Query::select('name'),
1049610507
Query::limit(1)
1049710508
]);
1049810509

@@ -10522,7 +10533,8 @@ public function testManyToManyOneWayRelationship(): void
1052210533

1052310534
// Select related document attributes
1052410535
$playlist = static::getDatabase()->findOne('playlist', [
10525-
Query::select(['*', 'songs.name'])
10536+
Query::select('*'),
10537+
Query::select('songs.name')
1052610538
]);
1052710539

1052810540
if ($playlist->isEmpty()) {
@@ -10533,7 +10545,8 @@ public function testManyToManyOneWayRelationship(): void
1053310545
$this->assertArrayNotHasKey('length', $playlist->getAttribute('songs')[0]);
1053410546

1053510547
$playlist = static::getDatabase()->getDocument('playlist', 'playlist1', [
10536-
Query::select(['*', 'songs.name'])
10548+
Query::select('*'),
10549+
Query::select('songs.name')
1053710550
]);
1053810551

1053910552
$this->assertEquals('Song 1', $playlist->getAttribute('songs')[0]->getAttribute('name'));
@@ -10904,7 +10917,8 @@ public function testManyToManyTwoWayRelationship(): void
1090410917

1090510918
// Select related document attributes
1090610919
$student = static::getDatabase()->findOne('students', [
10907-
Query::select(['*', 'classes.name'])
10920+
Query::select('*'),
10921+
Query::select('classes.name')
1090810922
]);
1090910923

1091010924
if ($student->isEmpty()) {
@@ -10915,7 +10929,8 @@ public function testManyToManyTwoWayRelationship(): void
1091510929
$this->assertArrayNotHasKey('number', $student->getAttribute('classes')[0]);
1091610930

1091710931
$student = static::getDatabase()->getDocument('students', 'student1', [
10918-
Query::select(['*', 'classes.name'])
10932+
Query::select('*'),
10933+
Query::select('classes.name')
1091910934
]);
1092010935

1092110936
$this->assertEquals('Class 1', $student->getAttribute('classes')[0]->getAttribute('name'));
@@ -11208,7 +11223,9 @@ public function testSelectRelationshipAttributes(): void
1120811223

1120911224
// Select some parent attributes, some child attributes
1121011225
$make = static::getDatabase()->findOne('make', [
11211-
Query::select(['name', 'models.name']),
11226+
Query::select('name'),
11227+
Query::select('models.name'),
11228+
Query::select('*'), // Added this to make tests pass, perhaps to add in to nesting queries?
1121211229
]);
1121311230

1121411231
if ($make->isEmpty()) {
@@ -11230,7 +11247,8 @@ public function testSelectRelationshipAttributes(): void
1123011247

1123111248
// Select internal attributes
1123211249
$make = static::getDatabase()->findOne('make', [
11233-
Query::select(['name', '$id']),
11250+
Query::select('name'),
11251+
Query::select('$id')
1123411252
]);
1123511253

1123611254
if ($make->isEmpty()) {
@@ -11245,7 +11263,8 @@ public function testSelectRelationshipAttributes(): void
1124511263
$this->assertArrayNotHasKey('$permissions', $make);
1124611264

1124711265
$make = static::getDatabase()->findOne('make', [
11248-
Query::select(['name', '$internalId']),
11266+
Query::select('name'),
11267+
Query::select('$internalId')
1124911268
]);
1125011269

1125111270
if ($make->isEmpty()) {
@@ -11260,7 +11279,8 @@ public function testSelectRelationshipAttributes(): void
1126011279
$this->assertArrayNotHasKey('$permissions', $make);
1126111280

1126211281
$make = static::getDatabase()->findOne('make', [
11263-
Query::select(['name', '$collection']),
11282+
Query::select('name'),
11283+
Query::select('$collection'),
1126411284
]);
1126511285

1126611286
if ($make->isEmpty()) {
@@ -11275,7 +11295,8 @@ public function testSelectRelationshipAttributes(): void
1127511295
$this->assertArrayNotHasKey('$permissions', $make);
1127611296

1127711297
$make = static::getDatabase()->findOne('make', [
11278-
Query::select(['name', '$createdAt']),
11298+
Query::select('name'),
11299+
Query::select('$createdAt'),
1127911300
]);
1128011301

1128111302
if ($make->isEmpty()) {
@@ -11290,7 +11311,8 @@ public function testSelectRelationshipAttributes(): void
1129011311
$this->assertArrayNotHasKey('$permissions', $make);
1129111312

1129211313
$make = static::getDatabase()->findOne('make', [
11293-
Query::select(['name', '$updatedAt']),
11314+
Query::select('name'),
11315+
Query::select('$updatedAt'),
1129411316
]);
1129511317

1129611318
if ($make->isEmpty()) {
@@ -11305,7 +11327,8 @@ public function testSelectRelationshipAttributes(): void
1130511327
$this->assertArrayNotHasKey('$permissions', $make);
1130611328

1130711329
$make = static::getDatabase()->findOne('make', [
11308-
Query::select(['name', '$permissions']),
11330+
Query::select('name'),
11331+
Query::select('$permissions'),
1130911332
]);
1131011333

1131111334
if ($make->isEmpty()) {

0 commit comments

Comments
 (0)