@@ -23,7 +23,7 @@ |
||
| 23 | 23 | public function updateProxy(ProxyGenerator &$proxy) |
| 24 | 24 | { |
| 25 | 25 | // In the closure, $this is the proxied database |
| 26 | - $callback = function ($args, $next) { |
|
| 26 | + $callback = function($args, $next) { |
|
| 27 | 27 | |
| 28 | 28 | // The first argument is always the sql query |
| 29 | 29 | $sql = $args[0]; |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | $players = Player::get()->with('Team'); |
| 31 | 31 | |
| 32 | - foreach($players as $player) { |
|
| 32 | + foreach ($players as $player) { |
|
| 33 | 33 | $team = $player->Team->Title; |
| 34 | 34 | } |
| 35 | 35 | $post_fetch_count = ProxyDBCounterExtension::getQueriesCount(); |
| 36 | 36 | |
| 37 | - $this->assertEquals($pre_fetch_count + $expectedQueries,$post_fetch_count); |
|
| 37 | + $this->assertEquals($pre_fetch_count + $expectedQueries, $post_fetch_count); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function testHasMany() |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | $teams = Team::get()->with('Players'); |
| 47 | 47 | |
| 48 | - foreach($teams as $team) { |
|
| 48 | + foreach ($teams as $team) { |
|
| 49 | 49 | $players = $team->Players()->map()->toArray(); |
| 50 | 50 | } |
| 51 | 51 | $post_fetch_count = ProxyDBCounterExtension::getQueriesCount(); |
| 52 | 52 | |
| 53 | - $this->assertEquals($pre_fetch_count + $expectedQueries,$post_fetch_count); |
|
| 53 | + $this->assertEquals($pre_fetch_count + $expectedQueries, $post_fetch_count); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | public function testManyMany() |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $players = Player::get()->with('Listens'); |
| 63 | 63 | |
| 64 | - foreach($players as $player) { |
|
| 64 | + foreach ($players as $player) { |
|
| 65 | 65 | $music = $player->Listens()->map()->toArray(); |
| 66 | 66 | // print_r($music); |
| 67 | 67 | } |
| 68 | 68 | $post_fetch_count = ProxyDBCounterExtension::getQueriesCount(); |
| 69 | 69 | |
| 70 | - $this->assertEquals($pre_fetch_count + $expectedQueries,$post_fetch_count); |
|
| 70 | + $this->assertEquals($pre_fetch_count + $expectedQueries, $post_fetch_count); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // public function testBelongsToManyMany() |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | ProxyDBCounterExtension::resetQueries(); |
| 95 | 95 | $pre_fetch_count = ProxyDBCounterExtension::getQueriesCount(); |
| 96 | 96 | |
| 97 | - $players = Player::get()->with(['Team','Origin']); |
|
| 97 | + $players = Player::get()->with(['Team', 'Origin']); |
|
| 98 | 98 | |
| 99 | - foreach($players as $player) { |
|
| 99 | + foreach ($players as $player) { |
|
| 100 | 100 | $team = $player->Team->Title; |
| 101 | 101 | $origin = $player->Origin->Title; |
| 102 | 102 | } |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | // print_r(ProxyDBCounterExtension::getQueries()); |
| 106 | 106 | |
| 107 | - $this->assertEquals($pre_fetch_count + $expectedQueries,$post_fetch_count); |
|
| 107 | + $this->assertEquals($pre_fetch_count + $expectedQueries, $post_fetch_count); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | public function testHasOneChain() |
@@ -115,14 +115,14 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $players = Player::get()->with(['Team.Origin']); |
| 117 | 117 | |
| 118 | - foreach($players as $player) { |
|
| 118 | + foreach ($players as $player) { |
|
| 119 | 119 | $team = $player->Team->Origin->Title; |
| 120 | 120 | } |
| 121 | 121 | $post_fetch_count = ProxyDBCounterExtension::getQueriesCount(); |
| 122 | 122 | |
| 123 | 123 | // print_r(ProxyDBCounterExtension::getQueries()); |
| 124 | 124 | |
| 125 | - $this->assertEquals($pre_fetch_count + $expectedQueries,$post_fetch_count); |
|
| 125 | + $this->assertEquals($pre_fetch_count + $expectedQueries, $post_fetch_count); |
|
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | public function testChainOneMany() |
@@ -133,12 +133,12 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | $players = Player::get()->with(['Team.Players']); |
| 135 | 135 | |
| 136 | - foreach($players as $player) { |
|
| 136 | + foreach ($players as $player) { |
|
| 137 | 137 | $team = $player->Team->Players()->map()->toArray(); |
| 138 | 138 | } |
| 139 | 139 | $post_fetch_count = ProxyDBCounterExtension::getQueriesCount(); |
| 140 | 140 | |
| 141 | - $this->assertEquals($pre_fetch_count + $expectedQueries,$post_fetch_count); |
|
| 141 | + $this->assertEquals($pre_fetch_count + $expectedQueries, $post_fetch_count); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | } |