Skip to content

Commit

Permalink
Merge pull request #4 from BapCat/master.7.4
Browse files Browse the repository at this point in the history
Update to php 7.4/8
  • Loading branch information
LordMonoxide committed Feb 19, 2021
2 parents cf61f3e + c6c524a commit e38a5a4
Show file tree
Hide file tree
Showing 12 changed files with 38 additions and 29 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
vendor/
composer.lock
.idea/
.phpunit.result.cache
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
language: php

php:
- 7.1
- 7.2
- 7.4
- 8.0

before_script:
- travis_retry composer self-update
Expand Down
18 changes: 13 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,31 @@
"name": "bapcat/hashing",
"description": "",
"license": "GPL-3.0-or-later",
"homepage": "http://github.com/BapCat/Hashing",
"homepage": "https://github.com/BapCat/Hashing",
"keywords": [],
"authors": [
{
"name": "Corey Frenette",
"email": "corey@narwhunderful.com"
}
],
"config": {
"preferred-install": "dist",
"platform": {
"php": "7.4"
},
"optimize-autoloader": true,
"sort-packages": true
},
"require": {
"php": "^7.1",
"php" : "^7.4|^8.0",
"ext-json": "*",
"bapcat/values": "^0.2"
"bapcat/values": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "^7.5",
"phpunit/phpunit": "^9.5",
"bapcat/services": "^0.3",
"bapcat/phi": "^1.0 || ^2.0 || ^3.0"
"bapcat/phi": "^1.0 || ^2.0 || ^3.0 || ^4.0"
},
"suggest": {
"bapcat/services": "The provided service will bind all base classes to sensible defaults"
Expand Down
24 changes: 14 additions & 10 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<testsuites>
<testsuite name="unit">
<directory>tests</directory>
</testsuite>
</testsuites>

<phpunit bootstrap="./vendor/autoload.php">
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>

<exclude>
<directory suffix=".php">vendor</directory>
</exclude>
</whitelist>
</filter>
</include>
<exclude>
<directory suffix=".php">vendor</directory>
</exclude>
</coverage>
</phpunit>
3 changes: 0 additions & 3 deletions src/PasswordHash.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<?php declare(strict_types=1); namespace BapCat\Hashing;

use BapCat\Interfaces\Values\Value;
use BapCat\Values\Password;

use InvalidArgumentException;

/**
* Represents a hashed password
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Algorithms/BcryptPasswordHasherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function testBcrypt(): void {
$this->doHash($hasher, PASSWORD_DEFAULT, 'Test test');
}

private function doHash(PasswordHasher $hasher, int $algo, string $password): void {
private function doHash(PasswordHasher $hasher, string $algo, string $password): void {
$password = new Password($password);

$hash = $hasher->make($password);
Expand Down
2 changes: 1 addition & 1 deletion tests/FastHashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function setUp(): void {

$this->hasher = $this
->getMockBuilder(FastHasher::class)
->setMethods(['check'])
->onlyMethods(['check'])
->getMockForAbstractClass();

$this->hasher
Expand Down
1 change: 0 additions & 1 deletion tests/HashTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php declare(strict_types=1);

use BapCat\Hashing\Hash;
use BapCat\Hashing\Hasher;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\TestCase;

Expand Down
2 changes: 1 addition & 1 deletion tests/HasherTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function setUp(): void {

$this->hasher = $this
->getMockBuilder(Hasher::class)
->setMethods(['make'])
->onlyMethods(['make'])
->getMockForAbstractClass();

$this->hasher
Expand Down
6 changes: 3 additions & 3 deletions tests/PasswordHashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ public function setUp(): void {

$this->hasher = $this
->getMockBuilder(PasswordHasher::class)
->setMethods(['check', 'needsRehash'])
->onlyMethods(['check', 'needsRehash'])
->getMockForAbstractClass()
;

$this->hasher
->method('check')
->will($this->returnCallback(function(string $input): bool {
return $input === 'testtest';
->will($this->returnCallback(function(Password $input): bool {
return (string)$input === 'testtest';
}))
;

Expand Down
2 changes: 1 addition & 1 deletion tests/StrongHashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function setUp(): void {

$this->hasher = $this
->getMockBuilder(StrongHasher::class)
->setMethods(['check'])
->onlyMethods(['check'])
->getMockForAbstractClass();

$this->hasher
Expand Down
2 changes: 1 addition & 1 deletion tests/WeakHashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function setUp(): void {

$this->hasher = $this
->getMockBuilder(WeakHasher::class)
->setMethods(['check'])
->onlyMethods(['check'])
->getMockForAbstractClass();

$this->hasher
Expand Down

0 comments on commit e38a5a4

Please sign in to comment.