Skip to content

Commit

Permalink
chore: tests for real-time report and php 8.2 test
Browse files Browse the repository at this point in the history
  • Loading branch information
akki-io committed May 20, 2023
1 parent c1c6098 commit c7714e6
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 15 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
branches: [ master ]

jobs:
test-php-74:
test-php-80:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -18,10 +18,10 @@ jobs:
- name: Start the test docker containers
run: docker-compose -f docker-compose-test.yml up -d
- name: Install composer dependencies
run: docker-compose -f docker-compose-test.yml exec -T php_74 composer install
run: docker-compose -f docker-compose-test.yml exec -T php_80 composer install
- name: Run PHPUnit Tests
run: docker-compose -f docker-compose-test.yml exec -T php_74 composer test
test-php-80:
run: docker-compose -f docker-compose-test.yml exec -T php_80 composer test
test-php-81:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -32,10 +32,10 @@ jobs:
- name: Start the test docker containers
run: docker-compose -f docker-compose-test.yml up -d
- name: Install composer dependencies
run: docker-compose -f docker-compose-test.yml exec -T php_80 composer install
run: docker-compose -f docker-compose-test.yml exec -T php_81 composer install
- name: Run PHPUnit Tests
run: docker-compose -f docker-compose-test.yml exec -T php_80 composer test
test-php-81:
run: docker-compose -f docker-compose-test.yml exec -T php_81 composer test
test-php-82:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -46,6 +46,6 @@ jobs:
- name: Start the test docker containers
run: docker-compose -f docker-compose-test.yml up -d
- name: Install composer dependencies
run: docker-compose -f docker-compose-test.yml exec -T php_81 composer install
run: docker-compose -f docker-compose-test.yml exec -T php_82 composer install
- name: Run PHPUnit Tests
run: docker-compose -f docker-compose-test.yml exec -T php_81 composer test
run: docker-compose -f docker-compose-test.yml exec -T php_82 composer test
12 changes: 7 additions & 5 deletions docker-compose-test.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
version: '2.1'

services:
php_74:
image: akkica/laravel-base:7.4
volumes:
- .:/var/www/html
- /var/www/html/vendor
php_80:
image: akkica/laravel-base:8.0
volumes:
- .:/var/www/html
- /var/www/html/vendor

php_81:
image: akkica/laravel-base:8.1
volumes:
- .:/var/www/html
- /var/www/html/vendor

php_82:
image: akkica/laravel-base:8.1
volumes:
- .:/var/www/html
- /var/www/html/vendor
2 changes: 2 additions & 0 deletions src/Facades/LaravelGoogleAnalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
* @method static getCredentials()
* @method static \Google\Analytics\Data\V1beta\BetaAnalyticsDataClient getClient()
* @method static \AkkiIo\LaravelGoogleAnalytics\LaravelGoogleAnalyticsResponse get()
* @method static \AkkiIo\LaravelGoogleAnalytics\LaravelGoogleAnalyticsResponse getRealTimeReport()
* @method static self dateRange(\AkkiIo\LaravelGoogleAnalytics\Period $period)
* @method static self dateRanges(\AkkiIo\LaravelGoogleAnalytics\Period ...$items)
* @method static self minuteRange(int $start, int $end = 0)
* @method static self metric(string $name)
* @method static self metrics(string ...$items)
* @method static self dimension(string $name)
Expand Down
13 changes: 12 additions & 1 deletion tests/LaravelGoogleAnalyticsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ protected function setUp(): void
->metricAggregation(MetricAggregation::TOTAL);
}

/** @test */
public function it_should_get_real_time_report()
{
$result = LaravelGoogleAnalytics::metrics('activeUsers')
->minuteRange(1)
->dimension('city')
->getRealTimeReport();


$this->assertCount(0, $result->table);
}

/** @test */
public function it_should_return_correct_count()
{
Expand Down Expand Up @@ -127,7 +139,6 @@ public function it_should_filter_dimension_with_and_group_receiving_an_filter_ob
$result = $this->analytics
->whereAndGroupDimensions([
$browserFilter,
//Not sure which other metric is available, but can be something like ['country', MatchType::CONTAINS, 'India']
])
->get();

Expand Down

0 comments on commit c7714e6

Please sign in to comment.