File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
tests/Integration/CachedBuilder Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -98,10 +98,17 @@ protected function getOrderByClauses() : string
98
98
99
99
protected function getQueryColumns (array $ columns ) : string
100
100
{
101
- if ($ columns === ["* " ] || $ columns === []) {
101
+ if (($ columns === ["* " ]
102
+ || $ columns === [])
103
+ && ! $ this ->query ->columns
104
+ ) {
102
105
return "" ;
103
106
}
104
107
108
+ if ($ this ->query ->columns ) {
109
+ return "_ " . implode ("_ " , $ this ->query ->columns );
110
+ }
111
+
105
112
return "_ " . implode ("_ " , $ columns );
106
113
}
107
114
Original file line number Diff line number Diff line change @@ -49,4 +49,29 @@ public function testSelectWithRawColumns()
49
49
$ this ->assertEquals ($ liveResults , $ books );
50
50
$ this ->assertEquals ($ liveResults , $ cachedResults );
51
51
}
52
+
53
+ // public function testSelectFieldsAreCached()
54
+ // {
55
+ // $key = sha1('genealabs:laravel-model-caching:testing::memory::authors:genealabslaravelmodelcachingtestsfixturesauthor_id_name-first');
56
+ // $tags = [
57
+ // 'genealabs:laravel-model-caching:testing::memory::genealabslaravelmodelcachingtestsfixturesauthor',
58
+ // ];
59
+
60
+ // $authorFields = (new Author)
61
+ // ->select("id", "name")
62
+ // ->first()
63
+ // ->getAttributes();
64
+ // $uncachedFields = (new UncachedAuthor)
65
+ // ->select("id", "name")
66
+ // ->first()
67
+ // ->getAttributes();
68
+ // $cachedFields = $this
69
+ // ->cache()
70
+ // ->tags($tags)
71
+ // ->get($key)['value']
72
+ // ->getAttributes();
73
+
74
+ // $this->assertEquals($cachedFields, $authorFields);
75
+ // $this->assertEquals($cachedFields, $uncachedFields);
76
+ // }
52
77
}
You can’t perform that action at this time.
0 commit comments