Skip to content

Commit bc9186b

Browse files
committed
Apply fixes from Rector
1 parent 4edec3b commit bc9186b

30 files changed

Lines changed: 166 additions & 141 deletions

tests/Functional/Controller/Admin/CategoryControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Entity\Category;
88
use App\Tests\Helper\WebTestHelper;
99
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
10+
use Symfony\Component\HttpFoundation\Request;
1011
use Symfony\Component\HttpFoundation\Response;
1112

1213
final class CategoryControllerTest extends WebTestCase
@@ -23,7 +24,7 @@ final class CategoryControllerTest extends WebTestCase
2324
public function testAdminNewCategory(): void
2425
{
2526
$client = $this->authAsAdmin($this);
26-
$crawler = $client->request('GET', '/en/admin/category/new');
27+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/category/new');
2728

2829
$form = $crawler->selectButton('Create category')->form([
2930
'category[name]' => self::NAME,
@@ -58,7 +59,7 @@ public function testAdminEditCategory(): void
5859
'slug' => self::SLUG,
5960
])->getId();
6061

61-
$crawler = $client->request('GET', '/en/admin/category/'.$category.'/edit');
62+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/category/'.$category.'/edit');
6263

6364
$form = $crawler->selectButton('Save changes')->form([
6465
'category[name]' => self::EDITED_NAME,
@@ -91,7 +92,7 @@ public function testAdminDeleteCategory(): void
9192
'slug' => self::SLUG,
9293
])->getId();
9394

94-
$crawler = $client->request('GET', '/en/admin/category');
95+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/category');
9596
$client->submit($crawler->filter('#delete-form-'.$category)->form());
9697
$this->assertSame(
9798
Response::HTTP_FOUND,

tests/Functional/Controller/Admin/CityControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace App\Tests\Functional\Controller\Admin;
66

77
use App\Entity\City;
8+
use Symfony\Component\HttpFoundation\Request;
89
use Symfony\Component\HttpFoundation\Response;
910

1011
final class CityControllerTest extends AbstractLocationControllerTest
@@ -14,7 +15,7 @@ final class CityControllerTest extends AbstractLocationControllerTest
1415
*/
1516
public function testAdminNewCity(): void
1617
{
17-
$crawler = $this->client->request('GET', '/en/admin/locations/city/new');
18+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/city/new');
1819

1920
$form = $crawler->selectButton('Create city')->form([
2021
'city[name]' => self::NAME,
@@ -52,7 +53,7 @@ public function testAdminEditCity(): void
5253
'slug' => self::SLUG,
5354
])->getId();
5455

55-
$crawler = $this->client->request('GET', '/en/admin/locations/city/'.$city.'/edit');
56+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/city/'.$city.'/edit');
5657

5758
$form = $crawler->selectButton('Save changes')->form([
5859
'city[name]' => self::EDITED_NAME,
@@ -88,7 +89,7 @@ public function testAdminDeleteCity(): void
8889
'slug' => self::SLUG,
8990
])->getId();
9091

91-
$crawler = $this->client->request('GET', '/en/admin/locations/city');
92+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/city');
9293
$this->client->submit($crawler->filter('#delete-form-'.$city)->form());
9394
$this->assertSame(
9495
Response::HTTP_FOUND,

tests/Functional/Controller/Admin/CurrencyControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Entity\Currency;
88
use App\Tests\Helper\WebTestHelper;
99
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
10+
use Symfony\Component\HttpFoundation\Request;
1011
use Symfony\Component\HttpFoundation\Response;
1112

1213
final class CurrencyControllerTest extends WebTestCase
@@ -23,7 +24,7 @@ public function testAdminNewCurrency(): void
2324
{
2425
$client = $this->authAsAdmin($this);
2526

26-
$crawler = $client->request('GET', '/en/admin/currency/new');
27+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/currency/new');
2728

2829
$form = $crawler->selectButton('Create currency')->form([
2930
'currency[currency_title]' => self::CURRENCY,
@@ -57,7 +58,7 @@ public function testAdminEditCurrency(): void
5758
'code' => self::CURRENCY,
5859
])->getId();
5960

60-
$crawler = $client->request('GET', '/en/admin/currency/'.$currency.'/edit');
61+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/currency/'.$currency.'/edit');
6162

6263
$form = $crawler->selectButton('Save changes')->form([
6364
'currency[currency_title]' => self::EDITED,
@@ -91,7 +92,7 @@ public function testAdminDeleteCurrency(): void
9192
'code' => self::EDITED,
9293
])->getId();
9394

94-
$crawler = $client->request('GET', '/en/admin/currency');
95+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/currency');
9596
$client->submit($crawler->filter('#delete-form-'.$currency)->form());
9697
$this->assertSame(
9798
Response::HTTP_FOUND,

tests/Functional/Controller/Admin/DashboardControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use App\Tests\Helper\WebTestHelper;
88
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
9+
use Symfony\Component\HttpFoundation\Request;
910

1011
final class DashboardControllerTest extends WebTestCase
1112
{
@@ -14,7 +15,7 @@ final class DashboardControllerTest extends WebTestCase
1415
public function testAdminDashboard(): void
1516
{
1617
$client = $this->authAsAdmin($this);
17-
$client->request('GET', '/en/admin');
18+
$client->request(Request::METHOD_GET, '/en/admin');
1819
$this->assertResponseIsSuccessful(sprintf('The %s public URL loads correctly.', '/admin'));
1920
}
2021
}

tests/Functional/Controller/Admin/DealTypeControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Entity\DealType;
88
use App\Tests\Helper\WebTestHelper;
99
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
10+
use Symfony\Component\HttpFoundation\Request;
1011
use Symfony\Component\HttpFoundation\Response;
1112

1213
final class DealTypeControllerTest extends WebTestCase
@@ -24,7 +25,7 @@ public function testAdminNewDealType(): void
2425
{
2526
$client = $this->authAsAdmin($this);
2627

27-
$crawler = $client->request('GET', '/en/admin/deal_type/new');
28+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/deal_type/new');
2829

2930
$form = $crawler->selectButton('Create deal type')->form([
3031
'deal_type[name]' => self::NAME,
@@ -59,7 +60,7 @@ public function testAdminEditDealType(): void
5960
'slug' => self::SLUG,
6061
])->getId();
6162

62-
$crawler = $client->request('GET', '/en/admin/deal_type/'.$dealType.'/edit');
63+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/deal_type/'.$dealType.'/edit');
6364

6465
$form = $crawler->selectButton('Save changes')->form([
6566
'deal_type[name]' => self::EDITED_NAME,
@@ -92,7 +93,7 @@ public function testAdminDeleteDealType(): void
9293
'slug' => self::SLUG,
9394
])->getId();
9495

95-
$crawler = $client->request('GET', '/en/admin/deal_type');
96+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/deal_type');
9697
$client->submit($crawler->filter('#delete-form-'.$dealType)->form());
9798
$this->assertSame(
9899
Response::HTTP_FOUND,

tests/Functional/Controller/Admin/DistrictControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace App\Tests\Functional\Controller\Admin;
66

77
use App\Entity\District;
8+
use Symfony\Component\HttpFoundation\Request;
89
use Symfony\Component\HttpFoundation\Response;
910

1011
final class DistrictControllerTest extends AbstractLocationControllerTest
@@ -14,7 +15,7 @@ final class DistrictControllerTest extends AbstractLocationControllerTest
1415
*/
1516
public function testAdminNewDistrict(): void
1617
{
17-
$crawler = $this->client->request('GET', '/en/admin/locations/district/new');
18+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/district/new');
1819

1920
$form = $crawler->selectButton('Create district')->form([
2021
'district[name]' => self::NAME,
@@ -46,7 +47,7 @@ public function testAdminEditDistrict(): void
4647
'slug' => self::SLUG,
4748
])->getId();
4849

49-
$crawler = $this->client->request('GET', '/en/admin/locations/district/'.$district.'/edit');
50+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/district/'.$district.'/edit');
5051

5152
$form = $crawler->selectButton('Save changes')->form([
5253
'district[name]' => self::EDITED_NAME,
@@ -72,7 +73,7 @@ public function testAdminEditDistrict(): void
7273
*/
7374
public function testAdminDeleteDistrict(): void
7475
{
75-
$crawler = $this->client->request('GET', '/en/admin/locations/district');
76+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/district');
7677

7778
$district = $this->getRepository($this->client, District::class)
7879
->findOneBy([

tests/Functional/Controller/Admin/FeatureControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Entity\Feature;
88
use App\Tests\Helper\WebTestHelper;
99
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
10+
use Symfony\Component\HttpFoundation\Request;
1011
use Symfony\Component\HttpFoundation\Response;
1112

1213
final class FeatureControllerTest extends WebTestCase
@@ -23,7 +24,7 @@ public function testAdminNewFeature(): void
2324
{
2425
$client = $this->authAsAdmin($this);
2526

26-
$crawler = $client->request('GET', '/en/admin/feature/new');
27+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/feature/new');
2728

2829
$form = $crawler->selectButton('Create feature')->form([
2930
'feature[name]' => self::FEATURE,
@@ -55,7 +56,7 @@ public function testAdminEditFeature(): void
5556
'name' => self::FEATURE,
5657
])->getId();
5758

58-
$crawler = $client->request('GET', '/en/admin/feature/'.$feature.'/edit');
59+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/feature/'.$feature.'/edit');
5960

6061
$form = $crawler->selectButton('Save changes')->form([
6162
'feature[name]' => self::EDITED,
@@ -86,7 +87,7 @@ public function testAdminDeleteFeature(): void
8687
'name' => self::EDITED,
8788
])->getId();
8889

89-
$crawler = $client->request('GET', '/en/admin/feature');
90+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/feature');
9091
$client->submit($crawler->filter('#delete-form-'.$feature)->form());
9192
$this->assertSame(
9293
Response::HTTP_FOUND,

tests/Functional/Controller/Admin/MenuControllerTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use App\Entity\Menu;
88
use App\Tests\Helper\WebTestHelper;
99
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
10+
use Symfony\Component\HttpFoundation\Request;
1011
use Symfony\Component\HttpFoundation\Response;
1112

1213
final class MenuControllerTest extends WebTestCase
@@ -25,7 +26,7 @@ public function testAdminNewItem(): void
2526
{
2627
$client = $this->authAsAdmin($this);
2728

28-
$crawler = $client->request('GET', '/en/admin/menu/new');
29+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/menu/new');
2930

3031
$form = $crawler->selectButton('Save changes')->form([
3132
'menu[title]' => self::TITLE,
@@ -63,7 +64,7 @@ public function testAdminEditItem(): void
6364
'locale' => self::LOCALE,
6465
])->getId();
6566

66-
$crawler = $client->request('GET', '/en/admin/menu/'.$item.'/edit');
67+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/menu/'.$item.'/edit');
6768

6869
$form = $crawler->selectButton('Save changes')->form([
6970
'menu[title]' => self::EDITED_TITLE,
@@ -90,26 +91,26 @@ public function testAdminEditItem(): void
9091
public function testAdminSortItems(): void
9192
{
9293
$client = $this->authAsAdmin($this);
93-
$crawler = $client->request('GET', '/en/admin/menu');
94+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/menu');
9495
$token = $this->getCsrfToken($crawler);
9596
$items = $this->getRepository($client, Menu::class)
9697
->findItems();
9798

9899
$itemsArray = array_map(fn ($item) => $item->getId(), $items);
99100

100101
$uri = '/en/admin/menu/sort';
101-
$client->request('POST', $uri, [
102+
$client->request(Request::METHOD_POST, $uri, [
102103
'csrf-token' => $token,
103104
'items' => array_reverse($itemsArray),
104105
]);
105106
$this->assertResponseStatusCodeSame(419);
106107

107-
$client->request('POST', $uri, [
108+
$client->request(Request::METHOD_POST, $uri, [
108109
'csrf_token' => $token,
109110
'items' => array_reverse($itemsArray),
110111
]);
111112

112-
$client->request('POST', $uri, [
113+
$client->request(Request::METHOD_POST, $uri, [
113114
'csrf_token' => $token,
114115
'items' => $itemsArray,
115116
]);
@@ -136,7 +137,7 @@ public function testAdminDeleteItem(): void
136137
'url' => self::URL,
137138
])->getId();
138139

139-
$crawler = $client->request('GET', '/en/admin/menu');
140+
$crawler = $client->request(Request::METHOD_GET, '/en/admin/menu');
140141
$client->submit($crawler->filter('#delete-form-'.$item)->form());
141142
$this->assertSame(
142143
Response::HTTP_FOUND,

tests/Functional/Controller/Admin/MetroControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace App\Tests\Functional\Controller\Admin;
66

77
use App\Entity\Metro;
8+
use Symfony\Component\HttpFoundation\Request;
89
use Symfony\Component\HttpFoundation\Response;
910

1011
final class MetroControllerTest extends AbstractLocationControllerTest
@@ -14,7 +15,7 @@ final class MetroControllerTest extends AbstractLocationControllerTest
1415
*/
1516
public function testAdminNewStation(): void
1617
{
17-
$crawler = $this->client->request('GET', '/en/admin/locations/metro/new');
18+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/metro/new');
1819

1920
$form = $crawler->selectButton('Create metro station')->form([
2021
'metro[name]' => self::NAME,
@@ -46,7 +47,7 @@ public function testAdminEditStation(): void
4647
'slug' => self::SLUG,
4748
])->getId();
4849

49-
$crawler = $this->client->request('GET', '/en/admin/locations/metro/'.$station.'/edit');
50+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/metro/'.$station.'/edit');
5051

5152
$form = $crawler->selectButton('Save changes')->form([
5253
'metro[name]' => self::EDITED_NAME,
@@ -73,7 +74,7 @@ public function testAdminDeleteStation(): void
7374
'slug' => self::SLUG,
7475
])->getId();
7576

76-
$crawler = $this->client->request('GET', '/en/admin/locations/metro');
77+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/metro');
7778
$this->client->submit($crawler->filter('#delete-metro-'.$station)->form());
7879
$this->assertSame(Response::HTTP_FOUND, $this->client->getResponse()->getStatusCode(), $this->client->getResponse()->getContent());
7980

tests/Functional/Controller/Admin/NeighborhoodControllerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace App\Tests\Functional\Controller\Admin;
66

77
use App\Entity\Neighborhood;
8+
use Symfony\Component\HttpFoundation\Request;
89
use Symfony\Component\HttpFoundation\Response;
910

1011
final class NeighborhoodControllerTest extends AbstractLocationControllerTest
@@ -14,7 +15,7 @@ final class NeighborhoodControllerTest extends AbstractLocationControllerTest
1415
*/
1516
public function testAdminNewNeighborhood(): void
1617
{
17-
$crawler = $this->client->request('GET', '/en/admin/locations/neighborhood/new');
18+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/neighborhood/new');
1819

1920
$form = $crawler->selectButton('Create neighborhood')->form([
2021
'neighborhood[name]' => self::NAME,
@@ -47,7 +48,7 @@ public function testAdminEditNeighborhood(): void
4748
'slug' => self::SLUG,
4849
])->getId();
4950

50-
$crawler = $this->client->request('GET', '/en/admin/locations/neighborhood/'.$neighborhood.'/edit');
51+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/neighborhood/'.$neighborhood.'/edit');
5152

5253
$form = $crawler->selectButton('Save changes')->form([
5354
'neighborhood[name]' => self::EDITED_NAME,
@@ -78,7 +79,7 @@ public function testAdminDeleteNeighborhood(): void
7879
'slug' => self::SLUG,
7980
])->getId();
8081

81-
$crawler = $this->client->request('GET', '/en/admin/locations/neighborhood');
82+
$crawler = $this->client->request(Request::METHOD_GET, '/en/admin/locations/neighborhood');
8283
$this->client->submit($crawler->filter('#delete-neighborhood-'.$neighborhood)->form());
8384
$this->assertSame(
8485
Response::HTTP_FOUND,

0 commit comments

Comments
 (0)