Skip to content

Commit

Permalink
Merge pull request #15 from ARCANEDEV/patch-1
Browse files Browse the repository at this point in the history
Updating the package
  • Loading branch information
arcanedev-maroc committed Feb 19, 2018
2 parents 4ba1ea8 + 139a5d2 commit ced27b7
Show file tree
Hide file tree
Showing 25 changed files with 72 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Expand Up @@ -22,7 +22,7 @@ checks:
tools:
external_code_coverage:
timeout: 600
runs: 2
runs: 3
php_code_sniffer:
enabled: true
config:
Expand Down
6 changes: 2 additions & 4 deletions .travis.yml
Expand Up @@ -5,18 +5,16 @@ sudo: false
php:
- 7.0
- 7.1
- 7.2
- nightly

matrix:
allow_failures:
- php: nightly

env:
- TESTBENCH_VERSION=3.5.*

before_script:
- travis_retry composer self-update
- travis_retry composer require --prefer-source --no-interaction --dev "orchestra/testbench-browser-kit:${TESTBENCH_VERSION}" "orchestra/database:${TESTBENCH_VERSION}"
- travis_retry composer install --prefer-source --no-interaction

script:
- composer validate
Expand Down
18 changes: 7 additions & 11 deletions composer.json
Expand Up @@ -18,16 +18,18 @@
"require": {
"php": ">=7.0",
"arcanedev/agent": "~3.0",
"arcanedev/geo-ip": "~2.2",
"arcanedev/support": "~4.2",
"arcanedev/geo-ip": "~2.2.0",
"arcanedev/support": "~4.2.0",
"jaybizzle/crawler-detect": "~1.2",
"ramsey/uuid": "~3.6",
"snowplow/referer-parser": "~0.2",
"ua-parser/uap-php" : "~3.4"
},
"require-dev": {
"phpunit/phpcov": "~4.0",
"phpunit/phpunit": "~6.0"
"orchestra/testbench": "~3.5.0",
"orchestra/database": "~3.5.0",
"phpunit/phpunit": "~6.0",
"phpunit/phpcov": "~4.0"
},
"autoload": {
"psr-4": {
Expand All @@ -43,13 +45,7 @@
"laravel": {
"providers": [
"Arcanedev\\LaravelTracker\\LaravelTrackerServiceProvider"
],
"aliases": {
"Tracker": "Arcanedev\\LaravelTracker\\Facades\\Tracker"
}
]
}
},
"scripts": {
"testbench": "composer require --dev \"orchestra/testbench-browser-kit=~3.5.0\" \"orchestra/database=~3.5.0\""
}
}
1 change: 1 addition & 0 deletions phpunit.xml.dist
Expand Up @@ -23,6 +23,7 @@
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="DB_CONNECTION" value="testing"/>
<env name="SESSION_DRIVER" value="array"/>
</php>
<logging>
Expand Down
2 changes: 1 addition & 1 deletion src/Bases/Migration.php
@@ -1,6 +1,6 @@
<?php namespace Arcanedev\LaravelTracker\Bases;

use Arcanedev\Support\Bases\Migration as BaseMigration;
use Arcanedev\Support\Database\Migration as BaseMigration;

/**
* Class Migration
Expand Down
2 changes: 1 addition & 1 deletion src/Models/AbstractModel.php
@@ -1,6 +1,6 @@
<?php namespace Arcanedev\LaravelTracker\Models;

use Arcanedev\Support\Bases\Model;
use Arcanedev\Support\Database\Model;

/**
* Class AbstractModel
Expand Down
4 changes: 2 additions & 2 deletions tests/Exceptions/ExceptionFactoryTest.php
Expand Up @@ -25,14 +25,14 @@ public function it_can_make()
foreach ($exceptions as $code => $class) {
$exception = ExceptionFactory::make($code, 'This is a message');

$this->assertInstanceOf($class, $exception);
static::assertInstanceOf($class, $exception);
}
}

/** @test */
public function it_can_make_default_if_not_supported()
{
$this->assertInstanceOf(
static::assertInstanceOf(
Errors\Error::class,
ExceptionFactory::make(600, 'Kabooom!!')
);
Expand Down
4 changes: 2 additions & 2 deletions tests/LaravelTrackerServiceProviderTest.php
Expand Up @@ -51,7 +51,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->provider);
static::assertInstanceOf($expected, $this->provider);
}
}

Expand All @@ -62,6 +62,6 @@ public function it_can_provides()
\Arcanedev\LaravelTracker\Contracts\Tracker::class,
];

$this->assertSame($expected, $this->provider->provides());
static::assertSame($expected, $this->provider->provides());
}
}
6 changes: 3 additions & 3 deletions tests/MigrationsTest.php
Expand Up @@ -23,11 +23,11 @@ public function it_can_publish_migrations()
$src = $this->getMigrationsSrcPath();
$dest = $this->getMigrationsDestPath();

$this->assertCount(0, $filesystem->allFiles($dest));
static::assertCount(0, $filesystem->allFiles($dest));

$this->publishMigrations();

$this->assertEquals(
static::assertEquals(
count($filesystem->allFiles($src)),
count($filesystem->allFiles($dest))
);
Expand All @@ -41,7 +41,7 @@ public function it_can_migrate()
$this->migrate();

foreach ($this->getTablesNames() as $table) {
$this->assertTrue(Schema::hasTable($table), "The table [$table] not found in the database.");
static::assertTrue(Schema::hasTable($table), "The table [$table] not found in the database.");
}
}

Expand Down
18 changes: 1 addition & 17 deletions tests/TestCase.php
@@ -1,6 +1,6 @@
<?php namespace Arcanedev\LaravelTracker\Tests;

use Orchestra\Testbench\BrowserKit\TestCase as BaseTestCase;
use Orchestra\Testbench\TestCase as BaseTestCase;

/**
* Class TestCase
Expand Down Expand Up @@ -60,26 +60,10 @@ protected function getEnvironmentSetUp($app)
{
\Arcanedev\LaravelTracker\Tracker::$runsMigrations = false;

$this->settingDatabase($app['config']);
$this->settingConfigs($app['config']);
$this->settingRoutes($app['router']);
}

/**
* Setting the database.
*
* @param \Illuminate\Contracts\Config\Repository $config
*/
private function settingDatabase($config)
{
$config->set('database.default', 'testing');
$config->set('database.connections.testing', [
'driver' => 'sqlite',
'database' => ':memory:',
'prefix' => '',
]);
}

/**
* Setting the configs.
*
Expand Down
19 changes: 10 additions & 9 deletions tests/TrackerTest.php
Expand Up @@ -24,6 +24,7 @@ class TrackerTest extends TestCase
public function setUp()
{
parent::setUp();

$this->migrate();

$this->tracker = $this->app->make(\Arcanedev\LaravelTracker\Contracts\Tracker::class);
Expand Down Expand Up @@ -51,9 +52,9 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->tracker);
static::assertInstanceOf($expected, $this->tracker);
}
$this->assertTrue($this->tracker->isEnabled());
static::assertTrue($this->tracker->isEnabled());
}

/** @test */
Expand All @@ -67,23 +68,23 @@ public function it_can_be_instantiated_via_contract()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->tracker);
static::assertInstanceOf($expected, $this->tracker);
}
$this->assertTrue($this->tracker->isEnabled());
static::assertTrue($this->tracker->isEnabled());
}

/** @test */
public function it_can_enable_and_disable()
{
$this->assertTrue($this->tracker->isEnabled());
static::assertTrue($this->tracker->isEnabled());

$this->tracker->disable();

$this->assertFalse($this->tracker->isEnabled());
static::assertFalse($this->tracker->isEnabled());

$this->tracker->enable();

$this->assertTrue($this->tracker->isEnabled());
static::assertTrue($this->tracker->isEnabled());
}

/** @test */
Expand All @@ -94,9 +95,9 @@ public function it_can_track()

$activities = \Arcanedev\LaravelTracker\Models\VisitorActivity::all();

$this->assertCount(1, $activities);
static::assertCount(1, $activities);

$this->assertNull($activities->first()->error_id);
static::assertNull($activities->first()->error_id);

// TODO: Adding more test assertions ?
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Trackers/CookieTrackerTest.php
Expand Up @@ -49,7 +49,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->tracker);
static::assertInstanceOf($expected, $this->tracker);
}
}

Expand All @@ -58,9 +58,9 @@ public function it_can_track()
{
$uuid = '25769c6c-d34d-4bfe-ba98-e0ee856f3e7a';

$this->assertSame(1, $this->tracker->track($uuid));
static::assertSame(1, $this->tracker->track($uuid));

$this->seeInDatabase('tracker_cookies', [
static::assertDatabaseHas('tracker_cookies', [
'id' => 1,
'uuid' => $uuid,
]);
Expand Down
4 changes: 2 additions & 2 deletions tests/Trackers/DeviceTrackerTest.php
Expand Up @@ -49,14 +49,14 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->tracker);
static::assertInstanceOf($expected, $this->tracker);
}
}

/** @test */
public function it_can_track()
{
$this->assertSame(1, $this->tracker->track());
static::assertSame(1, $this->tracker->track());

// TODO: Add database assertions
}
Expand Down
12 changes: 6 additions & 6 deletions tests/Trackers/ErrorTrackerTest.php
Expand Up @@ -49,7 +49,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->tracker);
static::assertInstanceOf($expected, $this->tracker);
}
}

Expand All @@ -58,9 +58,9 @@ public function it_can_track()
{
$exception = new \Exception('Page not found exception.', 404);

$this->assertSame(1, $this->tracker->track($exception));
static::assertSame(1, $this->tracker->track($exception));

$this->seeInDatabase('tracker_errors', [
$this->assertDatabaseHas('tracker_errors', [
'id' => 1,
'code' => $exception->getCode(),
'message' => $exception->getMessage(),
Expand All @@ -77,13 +77,13 @@ public function it_can_track_an_exception_with_handler()

$errors = \Arcanedev\LaravelTracker\Models\Error::all();

$this->assertCount(1, $errors);
static::assertCount(1, $errors);

/** @var \Arcanedev\LaravelTracker\Models\Error $error */
$error = $errors->first();

$this->assertSame('404', $error->code);
$this->assertSame('', $error->message);
static::assertSame('404', $error->code);
static::assertSame('', $error->message);

// TODO: Adding more test assertions ?
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Trackers/GeoIpTrackerTest.php
Expand Up @@ -49,7 +49,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->tracker);
static::assertInstanceOf($expected, $this->tracker);
}
}

Expand All @@ -58,9 +58,9 @@ public function it_can_track()
{
$ip = '128.101.101.101';

$this->assertSame(1, $this->tracker->track($ip));
static::assertSame(1, $this->tracker->track($ip));

$this->seeInDatabase('tracker_geoip', [
$this->assertDatabaseHas('tracker_geoip', [
'iso_code' => 'US',
'country' => 'United States',
'city' => 'Minneapolis',
Expand Down
4 changes: 2 additions & 2 deletions tests/Trackers/LanguageTrackerTest.php
Expand Up @@ -49,14 +49,14 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->tracker);
static::assertInstanceOf($expected, $this->tracker);
}
}

/** @test */
public function it_can_track()
{
$this->assertSame(1, $this->tracker->track());
static::assertSame(1, $this->tracker->track());

// TODO: Add database assertions
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Trackers/PathTrackerTest.php
Expand Up @@ -49,17 +49,17 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->tracker);
static::assertInstanceOf($expected, $this->tracker);
}
}

/** @test */
public function it_can_track()
{
$path = 'http://www.arcanedev.net';
$this->assertSame(1, $this->tracker->track($path));
static::assertSame(1, $this->tracker->track($path));

$this->seeInDatabase('tracker_paths', [
$this->assertDatabaseHas('tracker_paths', [
'id' => 1,
'path' => $path,
]);
Expand Down
2 changes: 1 addition & 1 deletion tests/Trackers/QueryTrackerTest.php
Expand Up @@ -52,7 +52,7 @@ public function it_can_track()
],
];

$this->assertSame(1, $this->tracker->track($queries));
static::assertSame(1, $this->tracker->track($queries));

// TODO: Add database assertions
}
Expand Down

0 comments on commit ced27b7

Please sign in to comment.