Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the package #10

Merged
merged 1 commit into from
Mar 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
.gitignore export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
phpunit.xml export-ignore
phpunit.xml.dist export-ignore
CONTRIBUTING.md export-ignore
2 changes: 1 addition & 1 deletion .scrutinizer.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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:${TESTBENCH_VERSION}"
- travis_retry composer install --prefer-source --no-interaction

script:
- composer validate
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2017 | ARCANEDEV <arcanedev.maroc@gmail.com> - Hasher
Copyright (c) 2015-2018 | ARCANEDEV <arcanedev.maroc@gmail.com> - Hasher

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
15 changes: 5 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
"license": "MIT",
"require": {
"php": ">=7.0",
"arcanedev/support": "~4.0",
"arcanedev/support": "~4.2.0",
"hashids/hashids": "~2.0"
},
"require-dev": {
"phpunit/phpunit": "~6.0",
"phpunit/phpcov": "~4.0"
"orchestra/testbench": "~3.5.0",
"phpunit/phpunit": "~6.0",
"phpunit/phpcov": "~4.0"
},
"autoload": {
"psr-4": {
Expand All @@ -39,13 +40,7 @@
"laravel": {
"providers": [
"Arcanedev\\Hasher\\HasherServiceProvider"
],
"aliases": {
"Hasher": "Arcanedev\\Hasher\\Facades\\Hasher"
}
]
}
},
"scripts": {
"testbench": "composer require --dev \"orchestra/testbench=~3.0\""
}
}
17 changes: 11 additions & 6 deletions config/hasher.php
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
<?php

return [
/* ------------------------------------------------------------------------------------------------

/* -----------------------------------------------------------------
| Defaults
| ------------------------------------------------------------------------------------------------
| -----------------------------------------------------------------
*/

'default' => [
'driver' => 'hashids',
'connection' => 'main',
],

/* ------------------------------------------------------------------------------------------------
/* -----------------------------------------------------------------
| Drivers
| ------------------------------------------------------------------------------------------------
| -----------------------------------------------------------------
*/

'drivers' => [
'hashids' => Arcanedev\Hasher\Drivers\HashidsDriver::class,
],

/* ------------------------------------------------------------------------------------------------
/* -----------------------------------------------------------------
| Connections
| ------------------------------------------------------------------------------------------------
| -----------------------------------------------------------------
*/

'connections' => [
'hashids' => [
'main' => [
Expand All @@ -37,4 +41,5 @@
// ],
],
],

];
File renamed without changes.
10 changes: 5 additions & 5 deletions tests/Drivers/HashidsDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ class HashidsDriverTest extends TestCase
| -----------------------------------------------------------------
*/

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

$this->hasher = new HashidsDriver($this->getConfig());
}

public function tearDown()
protected function tearDown()
{
unset($this->hasher);

Expand All @@ -52,7 +52,7 @@ public function it_can_be_instantiated()
];

foreach ($expectations as $expected) {
$this->assertInstanceOf($expected, $this->hasher);
static::assertInstanceOf($expected, $this->hasher);
}
}
/** @test */
Expand All @@ -61,8 +61,8 @@ public function it_assert_it_can_encode_and_decode()
$value = 123456;
$hashed = $this->hasher->encode($value);

$this->assertNotEquals($hashed, $value);
$this->assertSame($value, $this->hasher->decode($hashed));
static::assertNotEquals($hashed, $value);
static::assertSame($value, $this->hasher->decode($hashed));
}

/* -----------------------------------------------------------------
Expand Down
32 changes: 16 additions & 16 deletions tests/HasherManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ class HasherManagerTest extends TestCase
| -----------------------------------------------------------------
*/

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

$this->manager = $this->app->make(\Arcanedev\Hasher\Contracts\HashManager::class);
}

public function tearDown()
protected function tearDown()
{
unset($this->manager);

Expand All @@ -49,28 +49,28 @@ public function it_can_be_instantiated()
];

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

/** @test */
public function it_can_get_default_driver()
{
$this->assertSame('hashids', $this->manager->getDefaultDriver());
static::assertSame('hashids', $this->manager->getDefaultDriver());
}

/** @test */
public function it_can_get_default_connection()
{
$this->assertSame('main', $this->manager->getDefaultConnection());
static::assertSame('main', $this->manager->getDefaultConnection());
}

/** @test */
public function it_can_set_default_connection()
{
$this->manager->connection('alt');

$this->assertSame('alt', $this->manager->getDefaultConnection());
static::assertSame('alt', $this->manager->getDefaultConnection());
}

/** @test */
Expand All @@ -84,7 +84,7 @@ public function it_can_get_hash_driver_without_name()
];

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

Expand All @@ -99,7 +99,7 @@ public function it_can_get_hash_driver_with_name()
];

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

Expand All @@ -108,15 +108,15 @@ public function it_can_get_hash_driver_with_name_and_connection()
{
$driver = $this->manager->with('alt', 'custom');

$this->assertSame('alt', $this->manager->getDefaultConnection());
static::assertSame('alt', $this->manager->getDefaultConnection());

$expectations = [
\Arcanedev\Hasher\Contracts\HashDriver::class,
\Arcanedev\Hasher\Tests\Stubs\CustomHasherClient::class,
];

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

Expand All @@ -130,8 +130,8 @@ public function it_can_encode_and_decode()
$mainHashed = $mainDriver->encode($value);
$altHashed = $altDriver->encode($value);

$this->assertNotSame($mainHashed, $altHashed);
$this->assertSame(
static::assertNotSame($mainHashed, $altHashed);
static::assertSame(
$mainDriver->decode($mainHashed),
$altDriver->decode($altHashed)
);
Expand All @@ -147,8 +147,8 @@ public function it_can_encode_and_decode_with_helper()
$mainHashed = $mainDriver->encode($value);
$altHashed = $altDriver->encode($value);

$this->assertNotSame($mainHashed, $altHashed);
$this->assertSame(
static::assertNotSame($mainHashed, $altHashed);
static::assertSame(
$mainDriver->decode($mainHashed),
$altDriver->decode($altHashed)
);
Expand All @@ -160,7 +160,7 @@ public function it_can_encode_and_decode_from_manager()
$value = 123456;
$hashed = $this->manager->encode($value);

$this->assertNotSame($value, $hashed);
$this->assertSame($value, $this->manager->decode($hashed));
static::assertNotSame($value, $hashed);
static::assertSame($value, $this->manager->decode($hashed));
}
}
8 changes: 4 additions & 4 deletions tests/HasherServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ class HasherServiceProviderTest extends TestCase
| -----------------------------------------------------------------
*/

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

$this->provider = $this->app->getProvider(HasherServiceProvider::class);
}

public function tearDown()
protected function tearDown()
{
unset($this->provider);

Expand All @@ -53,7 +53,7 @@ public function it_can_be_instantiated()
];

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

Expand All @@ -64,6 +64,6 @@ public function it_can_provides()
\Arcanedev\Hasher\Contracts\HashManager::class,
];

$this->assertSame($expected, $this->provider->provides());
static::assertSame($expected, $this->provider->provides());
}
}
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ abstract class TestCase extends BaseTestCase
| -----------------------------------------------------------------
*/

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

$this->app->loadDeferredProviders();
}

public function tearDown()
protected function tearDown()
{
parent::tearDown();
}
Expand Down