Skip to content

Commit

Permalink
Fix phpunit deprecation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
grantholle committed Apr 18, 2024
1 parent dafe2e5 commit 9d52c31
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 39 deletions.
1 change: 0 additions & 1 deletion .phpunit.cache/test-results

This file was deleted.

30 changes: 10 additions & 20 deletions tests/Feature/AnalyticsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ protected function getEnvironmentSetUp($app): void
]);
}

/** @test */
public function a_page_view_can_be_tracked()
public function test_a_page_view_can_be_tracked()
{
$request = Request::create('/test', 'GET');
$request->setLaravelSession($this->app['session']->driver());
Expand All @@ -39,8 +38,7 @@ public function a_page_view_can_be_tracked()
]);
}

/** @test */
public function page_views_arent_tracked_when_not_enabled()
public function test_page_views_arent_tracked_when_not_enabled()
{
Config::set('analytics.enabled', false);
$request = Request::create('/page');
Expand All @@ -54,8 +52,7 @@ public function page_views_arent_tracked_when_not_enabled()
]);
}

/** @test */
public function a_page_view_can_be_masked()
public function test_a_page_view_can_be_masked()
{
$request = Request::create('/test/123', 'GET');
$request->setLaravelSession($this->app['session']->driver());
Expand All @@ -72,8 +69,7 @@ public function a_page_view_can_be_masked()
]);
}

/** @test */
public function a_page_view_can_be_excluded()
public function test_a_page_view_can_be_excluded()
{
$request = Request::create('/analytics/123', 'GET');
$request->setLaravelSession($this->app['session']->driver());
Expand All @@ -86,8 +82,7 @@ public function a_page_view_can_be_excluded()
]);
}

/** @test */
public function methods_can_be_excluded()
public function test_methods_can_be_excluded()
{
Config::set('analytics.ignoreMethods', ['POST']);
$request = Request::create('/users', 'POST');
Expand All @@ -101,8 +96,7 @@ public function methods_can_be_excluded()
]);
}

/** @test */
public function a_page_view_from_robot_can_be_tracked_if_enabled()
public function test_a_page_view_from_robot_can_be_tracked_if_enabled()
{
Config::set('analytics.ignoreRobots', false);

Expand All @@ -122,8 +116,7 @@ public function a_page_view_from_robot_can_be_tracked_if_enabled()
]);
}

/** @test */
public function a_page_view_from_robot_is_not_tracked_if_enabled()
public function test_a_page_view_from_robot_is_not_tracked_if_enabled()
{
Config::set('analytics.ignoreRobots', true);

Expand All @@ -142,8 +135,7 @@ public function a_page_view_from_robot_is_not_tracked_if_enabled()
]);
}

/** @test */
public function a_page_view_from_an_excluded_ip_is_not_tracked_if_enabled()
public function test_a_page_view_from_an_excluded_ip_is_not_tracked_if_enabled()
{
Config::set('analytics.ignoredIPs', ['127.0.0.2']);

Expand All @@ -161,8 +153,7 @@ public function a_page_view_from_an_excluded_ip_is_not_tracked_if_enabled()
]);
}

/** @test */
public function utm_details_can_be_saved_with_page_views()
public function test_utm_details_can_be_saved_with_page_views()
{
$request = Request::create('/test', 'GET', [
'utm_source' => 'test-source',
Expand Down Expand Up @@ -190,8 +181,7 @@ public function utm_details_can_be_saved_with_page_views()
]);
}

/** @test */
public function utm_details_will_be_trimmed()
public function test_utm_details_will_be_trimmed()
{
$string = Str::random(300);
$request = Request::create('/test', 'GET', [
Expand Down
18 changes: 6 additions & 12 deletions tests/Feature/DashboardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ public function setUp(): void
});
}

/** @test */
public function it_can_get_data_from_today()
public function test_it_can_get_data_from_today()
{
$this->get('analytics')
->assertViewHas('period', 'today')
Expand All @@ -53,8 +52,7 @@ public function it_can_get_data_from_today()
]);
}

/** @test */
public function it_can_get_data_from_yesterday()
public function test_it_can_get_data_from_yesterday()
{
$this->get(route('analytics', ['period' => 'yesterday']))
->assertViewHas('period', 'yesterday')
Expand All @@ -70,8 +68,7 @@ public function it_can_get_data_from_yesterday()
]);
}

/** @test */
public function it_can_get_data_for_1_week()
public function test_it_can_get_data_for_1_week()
{
$this->get(route('analytics', ['period' => '1_week']))
->assertViewHas('period', '1_week')
Expand All @@ -87,8 +84,7 @@ public function it_can_get_data_for_1_week()
]);
}

/** @test */
public function it_can_get_data_for_30_days()
public function test_it_can_get_data_for_30_days()
{
$this->get(route('analytics', ['period' => '30_days']))
->assertViewHas('period', '30_days')
Expand All @@ -104,8 +100,7 @@ public function it_can_get_data_for_30_days()
]);
}

/** @test */
public function it_can_get_data_for_30_days_filtered_by_uri()
public function test_it_can_get_data_for_30_days_filtered_by_uri()
{
$this->get(route('analytics', [
'period' => '30_days',
Expand All @@ -125,8 +120,7 @@ public function it_can_get_data_for_30_days_filtered_by_uri()
]);
}

/** @test */
public function it_can_view_sources()
public function test_it_can_view_sources()
{
$this->get(route('analytics', [
'period' => '30_days',
Expand Down
9 changes: 3 additions & 6 deletions tests/Feature/TimezoneTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ public function setUp(): void
PageView::resolveTimezoneUsing(fn () => 'America/Los_Angeles');
}

/** @test */
public function it_can_resolve_timezone()
public function test_it_can_resolve_timezone()
{
$pageView = new PageView();

Expand All @@ -49,8 +48,7 @@ public function it_can_resolve_timezone()
$this->assertEquals(config('app.timezone'), $pageView->getTimezone());
}

/** @test */
public function it_can_get_data_from_today()
public function test_it_can_get_data_from_today()
{
$views = PageView::query()
->filter('today')
Expand All @@ -59,8 +57,7 @@ public function it_can_get_data_from_today()
$this->assertEquals(2, $views);
}

/** @test */
public function it_can_get_data_from_yesterday()
public function test_it_can_get_data_from_yesterday()
{
$views = PageView::query()
->filter('yesterday')
Expand Down

0 comments on commit 9d52c31

Please sign in to comment.