Skip to content

Commit 325bfd2

Browse files
committed
tests to PSR12
1 parent 531b9cb commit 325bfd2

File tree

5 files changed

+46
-8
lines changed

5 files changed

+46
-8
lines changed

.styleci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
preset: laravel
1+
preset: psr12

tests/LaravelSubQueryWithAvgTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ public function testWithConditions()
5151
}]);
5252

5353
$this->assertEquals([
54-
['id' => 1, 'name' => 'text_name', 'items_price_avg' => 5.5, 'goods_price_avg' => 2.5, 'goods_price2_avg' => 3.5],
54+
[
55+
'id' => 1,
56+
'name' => 'text_name',
57+
'items_price_avg' => 5.5,
58+
'goods_price_avg' => 2.5,
59+
'goods_price2_avg' => 3.5
60+
],
5561
], $results->get()->toArray());
5662
}
5763

@@ -120,6 +126,11 @@ public function testSortingScopes()
120126

121127
$result = Invoice::withAvg('items:price')->toSql();
122128

123-
$this->assertSame('select "invoices".*, (select avg(price) from "items" where "invoices"."id" = "items"."invoice_id") as "items_price_avg" from "invoices"', $result);
129+
$this->assertSame(
130+
'select "invoices".*, (select avg(price) from "items"
131+
where "invoices"."id" = "items"."invoice_id") as "items_price_avg"
132+
from "invoices"',
133+
$result
134+
);
124135
}
125136
}

tests/LaravelSubQueryWithMaxTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ public function testWithConditions()
5151
}]);
5252

5353
$this->assertEquals([
54-
['id' => 1, 'name' => 'text_name', 'items_price_max' => 10, 'goods_price_max' => 4, 'goods_price2_max' => 5],
54+
[
55+
'id' => 1,
56+
'name' => 'text_name',
57+
'items_price_max' => 10,
58+
'goods_price_max' => 4,
59+
'goods_price2_max' => 5
60+
],
5561
], $results->get()->toArray());
5662
}
5763

@@ -120,6 +126,11 @@ public function testSortingScopes()
120126

121127
$result = Invoice::withMax('items:price')->toSql();
122128

123-
$this->assertSame('select "invoices".*, (select max(price) from "items" where "invoices"."id" = "items"."invoice_id") as "items_price_max" from "invoices"', $result);
129+
$this->assertSame(
130+
'select "invoices".*, (select max(price) from "items"
131+
where "invoices"."id" = "items"."invoice_id") as "items_price_max"
132+
from "invoices"',
133+
$result
134+
);
124135
}
125136
}

tests/LaravelSubQueryWithMinTest.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,11 @@ public function testSortingScopes()
120120

121121
$result = Invoice::withMin('items:price')->toSql();
122122

123-
$this->assertSame('select "invoices".*, (select min(price) from "items" where "invoices"."id" = "items"."invoice_id") as "items_price_min" from "invoices"', $result);
123+
$this->assertSame(
124+
'select "invoices".*, (select min(price) from "items"
125+
where "invoices"."id" = "items"."invoice_id") as "items_price_min"
126+
from "invoices"',
127+
$result
128+
);
124129
}
125130
}

tests/LaravelSubQueryWithSumTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@ public function testWithConditions()
5151
}]);
5252

5353
$this->assertEquals([
54-
['id' => 1, 'name' => 'text_name', 'items_price_sum' => 55, 'goods_price_sum' => 10, 'goods_price2_sum' => 14],
54+
[
55+
'id' => 1,
56+
'name' => 'text_name',
57+
'items_price_sum' => 55,
58+
'goods_price_sum' => 10,
59+
'goods_price2_sum' => 14
60+
],
5561
], $results->get()->toArray());
5662
}
5763

@@ -120,6 +126,11 @@ public function testSortingScopes()
120126

121127
$result = Invoice::withSum('items:price')->toSql();
122128

123-
$this->assertSame('select "invoices".*, (select sum(price) from "items" where "invoices"."id" = "items"."invoice_id") as "items_price_sum" from "invoices"', $result);
129+
$this->assertSame(
130+
'select "invoices".*, (select sum(price) from "items"
131+
where "invoices"."id" = "items"."invoice_id") as "items_price_sum"
132+
from "invoices"',
133+
$result
134+
);
124135
}
125136
}

0 commit comments

Comments
 (0)