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
9898
9999 protected function getQueryColumns (array $ columns ) : string
100100 {
101- if ($ columns === ["* " ] || $ columns === []) {
101+ if (($ columns === ["* " ]
102+ || $ columns === [])
103+ && ! $ this ->query ->columns
104+ ) {
102105 return "" ;
103106 }
104107
108+ if ($ this ->query ->columns ) {
109+ return "_ " . implode ("_ " , $ this ->query ->columns );
110+ }
111+
105112 return "_ " . implode ("_ " , $ columns );
106113 }
107114
Original file line number Diff line number Diff line change @@ -49,4 +49,29 @@ public function testSelectWithRawColumns()
4949 $ this ->assertEquals ($ liveResults , $ books );
5050 $ this ->assertEquals ($ liveResults , $ cachedResults );
5151 }
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+ // }
5277}
You can’t perform that action at this time.
0 commit comments