Skip to content

Commit

Permalink
Updating the package to support Laravel 5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
arcanedev-maroc committed Feb 8, 2018
1 parent 016fdb3 commit 3e69bee
Show file tree
Hide file tree
Showing 25 changed files with 792 additions and 740 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ language: php
sudo: false

php:
- 7.0
- 7.1.3
- 7.1
- 7.2
- nightly
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"type": "library",
"license": "MIT",
"require": {
"php": ">=7.0",
"php": ">=7.1.3",
"psr/log": "~1.0",
"arcanedev/support": "~4.1"
"arcanedev/support": "~4.3.0"
},
"require-dev": {
"orchestra/testbench": "~3.5.0",
"phpunit/phpunit": "~6.0",
"phpunit/phpcov": "~4.0"
"orchestra/testbench": "~3.6.0",
"phpunit/phpunit": "~7.0",
"phpunit/phpcov": "~5.0"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 3 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
>
syntaxCheck="true"
verbose="true">
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix=".php">./tests/</directory>
Expand Down
2 changes: 1 addition & 1 deletion src/Entities/LogCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

use Arcanedev\LogViewer\Contracts\Utilities\Filesystem as FilesystemContract;
use Arcanedev\LogViewer\Exceptions\LogNotFoundException;
use Arcanedev\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;

/**
* Class LogCollection
Expand Down
2 changes: 1 addition & 1 deletion src/Entities/LogEntryCollection.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php namespace Arcanedev\LogViewer\Entities;

use Arcanedev\LogViewer\Helpers\LogParser;
use Arcanedev\Support\Collection;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;

/**
* Class LogEntryCollection
Expand Down
9 changes: 5 additions & 4 deletions tests/Commands/CheckCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
*/
class CheckCommandTest extends TestCase
{
/* ------------------------------------------------------------------------------------------------
| Test Functions
| ------------------------------------------------------------------------------------------------
/* -----------------------------------------------------------------
| Tests
| -----------------------------------------------------------------
*/

/** @test */
public function it_can_check()
{
$code = $this->artisan('log-viewer:check');

$this->assertEquals(0, $code);
static::assertSame(0, $code);
}
}
78 changes: 42 additions & 36 deletions tests/Commands/PublishCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,39 @@
*/
class PublishCommandTest extends TestCase
{
/* ------------------------------------------------------------------------------------------------
| Main Functions
| ------------------------------------------------------------------------------------------------
/* -----------------------------------------------------------------
| Main Methods
| -----------------------------------------------------------------
*/
public function setUp()

protected function setUp()
{
parent::setUp();

//
}

public function tearDown()
protected function tearDown()
{
$this->deleteConfig();
$this->deleteLocalizations();

parent::tearDown();
}

/* ------------------------------------------------------------------------------------------------
| Test Functions
| ------------------------------------------------------------------------------------------------
/* -----------------------------------------------------------------
| Tests
| -----------------------------------------------------------------
*/

/** @test */
public function it_can_publish_all()
{
$code = $this->artisan('log-viewer:publish');

$this->assertEquals(0, $code);
$this->assertHasConfigFile();
$this->assertHasLocalizationFiles();
static::assertSame(0, $code);
static::assertHasConfigFile();
static::assertHasLocalizationFiles();
// TODO: Add views assertions
}

Expand All @@ -49,9 +53,9 @@ public function it_can_publish_all_with_force()
'--force' => true
]);

$this->assertEquals(0, $code);
$this->assertHasConfigFile();
$this->assertHasLocalizationFiles();
static::assertEquals(0, $code);
static::assertHasConfigFile();
static::assertHasLocalizationFiles();
// TODO: Add views assertions
}

Expand All @@ -62,9 +66,9 @@ public function it_can_publish_only_config()
'--tag' => 'config'
]);

$this->assertEquals(0, $code);
$this->assertHasConfigFile();
$this->assertHasNotLocalizationFiles();
static::assertSame(0, $code);
static::assertHasConfigFile();
static::assertHasNotLocalizationFiles();
// TODO: Add views assertions
}

Expand All @@ -75,32 +79,33 @@ public function it_can_publish_only_translations()
'--tag' => 'lang'
]);

$this->assertEquals(0, $code);
$this->assertHasNotConfigFile();
$this->assertHasLocalizationFiles();
static::assertSame(0, $code);
static::assertHasNotConfigFile();
static::assertHasLocalizationFiles();
// TODO: Add views assertions
}

/* ------------------------------------------------------------------------------------------------
| Assertion Functions
| ------------------------------------------------------------------------------------------------
/* -----------------------------------------------------------------
| Custom Assertions
| -----------------------------------------------------------------
*/

/**
* Assert config file publishes
*/
protected function assertHasConfigFile()
{
$this->assertFileExists($this->getConfigFilePath());
$this->assertTrue($this->isConfigExists());
static::assertFileExists($this->getConfigFilePath());
static::assertTrue($this->isConfigExists());
}

/**
* Assert config file publishes
*/
protected function assertHasNotConfigFile()
{
$this->assertFileNotExists($this->getConfigFilePath());
$this->assertFalse($this->isConfigExists());
static::assertFileNotExists($this->getConfigFilePath());
static::assertFalse($this->isConfigExists());
}

/**
Expand All @@ -112,13 +117,13 @@ protected function assertHasLocalizationFiles()
$directories = $this->illuminateFile()->directories($path);
$locales = array_map('basename', $directories);

$this->assertEmpty(
static::assertEmpty(
$missing = array_diff($locales, self::$locales),
'The locales [' . implode(', ', $missing) . '] are missing in the Arcanedev\\LogViewer\\Tests\\TestCase::$locales (line 29) for tests purposes.'
'The locales ['.implode(', ', $missing).'] are missing in the Arcanedev\\LogViewer\\Tests\\TestCase::$locales (line 29) for tests purposes.'
);

foreach ($directories as $directory) {
$this->assertFileExists($directory . '/levels.php');
static::assertFileExists($directory . '/levels.php');
}
}

Expand All @@ -127,13 +132,14 @@ protected function assertHasLocalizationFiles()
*/
protected function assertHasNotLocalizationFiles()
{
$this->assertFalse($this->getLocalizationFolder());
static::assertFalse($this->getLocalizationFolder());
}

/* ------------------------------------------------------------------------------------------------
| Other Functions
| ------------------------------------------------------------------------------------------------
/* -----------------------------------------------------------------
| Other Methods
| -----------------------------------------------------------------
*/

private function deleteConfig()
{
$config = $this->getConfigFilePath();
Expand Down Expand Up @@ -162,7 +168,7 @@ private function isConfigExists()
*/
private function getConfigFilePath()
{
return $this->getConfigPath() . '/log-viewer.php';
return $this->getConfigPath().'/log-viewer.php';
}

/**
Expand All @@ -172,7 +178,7 @@ private function getConfigFilePath()
*/
private function getLocalizationFolder()
{
return realpath(base_path() . '/resources/lang/vendor/log-viewer');
return realpath(base_path().'/resources/lang/vendor/log-viewer');
}

/**
Expand Down
9 changes: 5 additions & 4 deletions tests/Commands/StatsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
*/
class StatsCommandTest extends TestCase
{
/* ------------------------------------------------------------------------------------------------
| Test Functions
| ------------------------------------------------------------------------------------------------
/* -----------------------------------------------------------------
| Tests
| -----------------------------------------------------------------
*/

/** @test */
public function it_can_display_stats()
{
$code = $this->artisan('log-viewer:stats');

$this->assertEquals(0, $code);
static::assertSame(0, $code);
}
}
Loading

0 comments on commit 3e69bee

Please sign in to comment.