Skip to content

Commit da9ec56

Browse files
Merge pull request #19 from esign/shift-140872
PHPUnit 10 Shift
2 parents 8c3a26d + 6f4e472 commit da9ec56

11 files changed

+84
-73
lines changed

tests/Feature/ConversionsApiTest.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22

33
namespace Esign\ConversionsApi\Tests\Feature;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\ConversionsApi\Collections\EventCollection;
67
use Esign\ConversionsApi\Facades\ConversionsApi;
78
use Esign\ConversionsApi\Tests\TestCase;
89
use FacebookAds\Object\ServerSide\Event;
910
use FacebookAds\Object\ServerSide\UserData;
1011

11-
class ConversionsApiTest extends TestCase
12+
final class ConversionsApiTest extends TestCase
1213
{
13-
/** @test */
14-
public function it_can_set_user_data_by_default()
14+
#[Test]
15+
public function it_can_set_user_data_by_default(): void
1516
{
1617
request()->headers->set('USER_AGENT', 'Esign Agent');
1718
request()->server->set('REMOTE_ADDR', '0.0.0.0');
@@ -20,8 +21,8 @@ public function it_can_set_user_data_by_default()
2021
$this->assertEquals('Esign Agent', ConversionsApi::getUserData()->getClientUserAgent());
2122
}
2223

23-
/** @test */
24-
public function it_can_set_user_data()
24+
#[Test]
25+
public function it_can_set_user_data(): void
2526
{
2627
ConversionsApi::setUserData(
2728
(new UserData())->setFirstName('John')->setLastName('Doe')
@@ -31,8 +32,8 @@ public function it_can_set_user_data()
3132
$this->assertEquals('Doe', ConversionsApi::getUserData()->getLastName());
3233
}
3334

34-
/** @test */
35-
public function it_can_add_an_event()
35+
#[Test]
36+
public function it_can_add_an_event(): void
3637
{
3738
ConversionsApi::addEvent(
3839
(new Event())->setEventName('PageView')->setEventId('abc')
@@ -43,8 +44,8 @@ public function it_can_add_an_event()
4344
$this->assertEquals('abc', ConversionsApi::getEvents()->first()->getEventId());
4445
}
4546

46-
/** @test */
47-
public function it_can_add_multiple_events()
47+
#[Test]
48+
public function it_can_add_multiple_events(): void
4849
{
4950
ConversionsApi::addEvent(
5051
(new Event())->setEventName('PageView')->setEventId('abc')
@@ -58,8 +59,8 @@ public function it_can_add_multiple_events()
5859
$this->assertEquals('abc', ConversionsApi::getEvents()->first()->getEventId());
5960
}
6061

61-
/** @test */
62-
public function it_can_set_an_array_of_events()
62+
#[Test]
63+
public function it_can_set_an_array_of_events(): void
6364
{
6465
ConversionsApi::addEvent(
6566
(new Event())->setEventName('PageView')->setEventId('abc')
@@ -73,8 +74,8 @@ public function it_can_set_an_array_of_events()
7374
$this->assertEquals('xyz', ConversionsApi::getEvents()->first()->getEventId());
7475
}
7576

76-
/** @test */
77-
public function it_can_clear_events()
77+
#[Test]
78+
public function it_can_clear_events(): void
7879
{
7980
ConversionsApi::setEvents([
8081
(new Event())->setEventName('PageView')->setEventId('abc'),
@@ -85,8 +86,8 @@ public function it_can_clear_events()
8586
$this->assertCount(0, ConversionsApi::getEvents());
8687
}
8788

88-
/** @test */
89-
public function it_can_get_events()
89+
#[Test]
90+
public function it_can_get_events(): void
9091
{
9192
ConversionsApi::setEvents([
9293
(new Event())->setEventName('PageView')->setEventId('abc'),

tests/Feature/View/Components/DataLayerPageViewTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
namespace Esign\ConversionsApi\Tests\Feature\View\Components;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\ConversionsApi\ConversionsApi;
67
use Esign\ConversionsApi\Tests\TestCase;
78
use Esign\ConversionsApi\View\Components\DataLayerPageView;
89
use Illuminate\Foundation\Testing\Concerns\InteractsWithViews;
910
use Illuminate\Support\Str;
1011
use Mockery\MockInterface;
1112

12-
class DataLayerPageViewTest extends TestCase
13+
final class DataLayerPageViewTest extends TestCase
1314
{
1415
use InteractsWithViews;
1516

16-
/** @test */
17-
public function it_can_render_the_view()
17+
#[Test]
18+
public function it_can_render_the_view(): void
1819
{
1920
Str::createUuidsUsing(fn () => 'b13ddf8f-df2d-4554-9ae6-a1a73861b0ad');
2021
$component = $this->component(DataLayerPageView::class);
@@ -25,8 +26,8 @@ public function it_can_render_the_view()
2526
);
2627
}
2728

28-
/** @test */
29-
public function it_can_execute_a_page_view_event()
29+
#[Test]
30+
public function it_can_execute_a_page_view_event(): void
3031
{
3132
$this->mock(ConversionsApi::class, function (MockInterface $mock) {
3233
$mock->shouldReceive('getUserData')->once();

tests/Feature/View/Components/DataLayerUserDataVariableTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Esign\ConversionsApi\Tests\Feature\View\Components;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\ConversionsApi\Facades\ConversionsApi;
67
use Esign\ConversionsApi\Objects\DefaultUserData;
78
use Esign\ConversionsApi\Tests\Support\Events\ContactEvent;
@@ -10,12 +11,12 @@
1011
use Esign\ConversionsApi\View\Components\DataLayerVariable;
1112
use Illuminate\Foundation\Testing\Concerns\InteractsWithViews;
1213

13-
class DataLayerUserDataVariableTest extends TestCase
14+
final class DataLayerUserDataVariableTest extends TestCase
1415
{
1516
use InteractsWithViews;
1617

17-
/** @test */
18-
public function it_can_render_the_view()
18+
#[Test]
19+
public function it_can_render_the_view(): void
1920
{
2021
ConversionsApi::setUserData(
2122
DefaultUserData::create()->setEmail('[email protected]')

tests/Feature/View/Components/DataLayerVariableTest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22

33
namespace Esign\ConversionsApi\Tests\Feature\View\Components;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\ConversionsApi\Tests\Support\Events\ContactEvent;
67
use Esign\ConversionsApi\Tests\TestCase;
78
use Esign\ConversionsApi\View\Components\DataLayerVariable;
89
use Illuminate\Foundation\Testing\Concerns\InteractsWithViews;
910

10-
class DataLayerVariableTest extends TestCase
11+
final class DataLayerVariableTest extends TestCase
1112
{
1213
use InteractsWithViews;
1314

14-
/** @test */
15-
public function it_can_render_the_view()
15+
#[Test]
16+
public function it_can_render_the_view(): void
1617
{
1718
$event = (new ContactEvent())->setEventId('9a97e3f0-3dbb-4d74-bf05-a42f330f843d');
1819
$component = $this->component(DataLayerVariable::class, [
@@ -25,8 +26,8 @@ public function it_can_render_the_view()
2526
);
2627
}
2728

28-
/** @test */
29-
public function it_can_render_anonymously()
29+
#[Test]
30+
public function it_can_render_anonymously(): void
3031
{
3132
$view = $this->blade('
3233
<x-conversions-api::data-layer-variable
@@ -37,8 +38,8 @@ public function it_can_render_anonymously()
3738
$view->assertSee('window.dataLayer.push({"event":"contact"});', false);
3839
}
3940

40-
/** @test */
41-
public function it_can_pass_component_attributes()
41+
#[Test]
42+
public function it_can_pass_component_attributes(): void
4243
{
4344
$view = $this->blade('
4445
<x-conversions-api::data-layer-variable

tests/Feature/View/Components/FacebookPixelPageViewTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
namespace Esign\ConversionsApi\Tests\Feature\View\Components;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\ConversionsApi\ConversionsApi;
67
use Esign\ConversionsApi\Tests\TestCase;
78
use Esign\ConversionsApi\View\Components\FacebookPixelPageView;
89
use Illuminate\Foundation\Testing\Concerns\InteractsWithViews;
910
use Illuminate\Support\Str;
1011
use Mockery\MockInterface;
1112

12-
class FacebookPixelPageViewTest extends TestCase
13+
final class FacebookPixelPageViewTest extends TestCase
1314
{
1415
use InteractsWithViews;
1516

16-
/** @test */
17-
public function it_can_render_the_view()
17+
#[Test]
18+
public function it_can_render_the_view(): void
1819
{
1920
Str::createUuidsUsing(fn () => 'b13ddf8f-df2d-4554-9ae6-a1a73861b0ad');
2021
$component = $this->component(FacebookPixelPageView::class);
@@ -25,8 +26,8 @@ public function it_can_render_the_view()
2526
);
2627
}
2728

28-
/** @test */
29-
public function it_can_execute_a_page_view_event()
29+
#[Test]
30+
public function it_can_execute_a_page_view_event(): void
3031
{
3132
$this->mock(ConversionsApi::class, function (MockInterface $mock) {
3233
$mock->shouldReceive('getUserData')->once();

tests/Feature/View/Components/FacebookPixelScriptTest.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
namespace Esign\ConversionsApi\Tests\Feature\View\Components;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\ConversionsApi\Facades\ConversionsApi;
67
use Esign\ConversionsApi\Tests\TestCase;
78
use Esign\ConversionsApi\View\Components\FacebookPixelScript;
89
use FacebookAds\Object\ServerSide\UserData;
910
use Illuminate\Foundation\Testing\Concerns\InteractsWithViews;
1011
use Illuminate\Support\Facades\Config;
1112

12-
class FacebookPixelScriptTest extends TestCase
13+
final class FacebookPixelScriptTest extends TestCase
1314
{
1415
use InteractsWithViews;
1516

16-
/** @test */
17-
public function it_can_render_the_view_using_default_data()
17+
#[Test]
18+
public function it_can_render_the_view_using_default_data(): void
1819
{
1920
Config::set('conversions-api.pixel_id', '414800860114807');
2021
ConversionsApi::setUserData((new UserData())->setEmail('[email protected]'));
@@ -23,17 +24,17 @@ public function it_can_render_the_view_using_default_data()
2324
$component->assertSee("fbq('init', '414800860114807', {\"em\":\"[email protected]\"});", false);
2425
}
2526

26-
/** @test */
27-
public function it_can_render_an_empty_object_for_advanced_matching_data()
27+
#[Test]
28+
public function it_can_render_an_empty_object_for_advanced_matching_data(): void
2829
{
2930
Config::set('conversions-api.pixel_id', '414800860114807');
3031
$component = $this->component(FacebookPixelScript::class);
3132

3233
$component->assertSee("fbq('init', '414800860114807', {});", false);
3334
}
3435

35-
/** @test */
36-
public function it_can_render_the_view_passing_custom_data()
36+
#[Test]
37+
public function it_can_render_the_view_passing_custom_data(): void
3738
{
3839
$component = $this->component(FacebookPixelScript::class, [
3940
'pixelId' => '744689831385767',
@@ -43,8 +44,8 @@ public function it_can_render_the_view_passing_custom_data()
4344
$component->assertSee("fbq('init', '744689831385767', {\"em\":\"[email protected]\"});", false);
4445
}
4546

46-
/** @test */
47-
public function it_can_pass_component_attributes()
47+
#[Test]
48+
public function it_can_pass_component_attributes(): void
4849
{
4950
$view = $this->blade('
5051
<x-conversions-api::data-layer-variable

tests/Feature/View/Components/FacebookPixelTrackingEventTest.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,20 @@
22

33
namespace Esign\ConversionsApi\Tests\Feature\View\Components;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\ConversionsApi\Tests\Support\Events\PurchaseEvent;
67
use Esign\ConversionsApi\Tests\TestCase;
78
use Esign\ConversionsApi\View\Components\FacebookPixelTrackingEvent;
89
use FacebookAds\Object\ServerSide\Content;
910
use FacebookAds\Object\ServerSide\CustomData;
1011
use Illuminate\Foundation\Testing\Concerns\InteractsWithViews;
1112

12-
class FacebookPixelTrackingEventTest extends TestCase
13+
final class FacebookPixelTrackingEventTest extends TestCase
1314
{
1415
use InteractsWithViews;
1516

16-
/** @test */
17-
public function it_can_render_the_view()
17+
#[Test]
18+
public function it_can_render_the_view(): void
1819
{
1920
$event = (new PurchaseEvent());
2021
$component = $this->component(FacebookPixelTrackingEvent::class, [
@@ -25,8 +26,8 @@ public function it_can_render_the_view()
2526
$component->assertSee('Purchase');
2627
}
2728

28-
/** @test */
29-
public function it_can_encode_custom_data_and_event_data_as_objects_when_they_are_empty_arrays()
29+
#[Test]
30+
public function it_can_encode_custom_data_and_event_data_as_objects_when_they_are_empty_arrays(): void
3031
{
3132
$event = (new PurchaseEvent());
3233
$component = $this->component(FacebookPixelTrackingEvent::class, [
@@ -39,8 +40,8 @@ public function it_can_encode_custom_data_and_event_data_as_objects_when_they_ar
3940
);
4041
}
4142

42-
/** @test */
43-
public function it_can_json_encode_custom_data_and_event_data()
43+
#[Test]
44+
public function it_can_json_encode_custom_data_and_event_data(): void
4445
{
4546
$contents = (new Content())->setProductId('10')->setQuantity(2);
4647
$customData = (new CustomData())->setValue(120)->setCurrency('GBP')->setContents([$contents]);
@@ -55,8 +56,8 @@ public function it_can_json_encode_custom_data_and_event_data()
5556
);
5657
}
5758

58-
/** @test */
59-
public function it_can_render_anonymously()
59+
#[Test]
60+
public function it_can_render_anonymously(): void
6061
{
6162
$view = $this->blade('
6263
<x-conversions-api::facebook-pixel-tracking-event
@@ -70,8 +71,8 @@ public function it_can_render_anonymously()
7071
$view->assertSee("fbq('track', 'Purchase', {}, {});", false);
7172
}
7273

73-
/** @test */
74-
public function it_can_pass_component_attributes()
74+
#[Test]
75+
public function it_can_pass_component_attributes(): void
7576
{
7677
$view = $this->blade('
7778
<x-conversions-api::facebook-pixel-tracking-event

tests/Feature/View/Components/GoogleTagManagerBodyTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,27 @@
22

33
namespace Esign\ConversionsApi\Tests\Feature\View\Components;
44

5+
use PHPUnit\Framework\Attributes\Test;
56
use Esign\ConversionsApi\Tests\TestCase;
67
use Esign\ConversionsApi\View\Components\GoogleTagManagerBody;
78
use Illuminate\Foundation\Testing\Concerns\InteractsWithViews;
89
use Illuminate\Support\Facades\Config;
910

10-
class GoogleTagManagerBodyTest extends TestCase
11+
final class GoogleTagManagerBodyTest extends TestCase
1112
{
1213
use InteractsWithViews;
1314

14-
/** @test */
15-
public function it_can_render_the_view()
15+
#[Test]
16+
public function it_can_render_the_view(): void
1617
{
1718
Config::set('conversions-api.gtm_id', 'GTM-123456');
1819
$component = $this->component(GoogleTagManagerBody::class);
1920

2021
$component->assertSee('https://www.googletagmanager.com/ns.html?id=GTM-123456');
2122
}
2223

23-
/** @test */
24-
public function it_can_render_the_view_using_custom_data()
24+
#[Test]
25+
public function it_can_render_the_view_using_custom_data(): void
2526
{
2627
Config::set('conversions-api.gtm_id', null);
2728
$component = $this->component(GoogleTagManagerBody::class, [

0 commit comments

Comments
 (0)