Skip to content

Commit

Permalink
Merge pull request #16 from peter279k/test_enhancement
Browse files Browse the repository at this point in the history
Test enhancement
  • Loading branch information
DivineOmega authored Oct 9, 2018
2 parents 43b61d6 + e7bd99e commit 3d63dd6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 9 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ dist: trusty
php:
- '7.1.18'
- '7.2'
- nightly
- 'hhvm'
matrix:
allow_failures:
- php: nightly
install:
- composer update
- composer install
script:
- ./vendor/bin/phpunit --coverage-clover ./tests/Logs/clover.xml
- ./vendor/bin/psalm
after_script:
- php vendor/bin/php-coveralls -v
- php vendor/bin/php-coveralls -v
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"require-dev": {
"phpunit/phpunit": "^5.7",
"phpunit/phpunit": "^6.5",
"fzaninotto/faker": "^1.7",
"vimeo/psalm": "^1",
"php-coveralls/php-coveralls": "^2.1"
Expand All @@ -22,6 +22,11 @@
"src/PasswordExposedFunction.php"
]
},
"autoload-dev": {
"psr-4": {
"DivineOmega\\PasswordExposed\\Tests\\": "tests/"
}
},
"license": "LGPL-3.0-only",
"require": {
"php": ">=5.6",
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/BundleInjectionTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace DivineOmega\PasswordExposed\Tests;

use DivineOmega\PasswordExposed\PasswordExposedChecker;
use DivineOmega\PasswordExposed\PasswordStatus;
use ParagonIE\Certainty\Bundle;
Expand Down
23 changes: 17 additions & 6 deletions tests/Unit/PasswordExposedTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?php

namespace DivineOmega\PasswordExposed\Tests;

use DivineOmega\PasswordExposed\PasswordStatus;
use Faker\Factory;
use PHPUnit\Framework\TestCase;

class PasswordExposedTest extends TestCase
Expand All @@ -10,13 +13,21 @@ public function testFunctionExists()
$this->assertTrue(function_exists('password_exposed'));
}

public function testExposedPasswords()
public function exposedPasswordsProvider()
{
$passwords = ['test', 'password', 'hunter2'];
return [
['test'],
['password'],
['hunter2'],
];
}

foreach ($passwords as $password) {
$this->assertEquals(password_exposed($password), PasswordStatus::EXPOSED);
}
/**
* @dataProvider exposedPasswordsProvider
*/
public function testExposedPasswords($password)
{
$this->assertEquals(password_exposed($password), PasswordStatus::EXPOSED);
}

public function testNotExposedPasswords()
Expand All @@ -26,7 +37,7 @@ public function testNotExposedPasswords()

private function getPasswordUnlikelyToBeExposed()
{
$faker = Faker\Factory::create();
$faker = Factory::create();

$password = '';

Expand Down

0 comments on commit 3d63dd6

Please sign in to comment.