Skip to content

Commit 3d63dd6

Browse files
authored
Merge pull request #16 from peter279k/test_enhancement
Test enhancement
2 parents 43b61d6 + e7bd99e commit 3d63dd6

File tree

4 files changed

+31
-9
lines changed

4 files changed

+31
-9
lines changed

.travis.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ dist: trusty
33
php:
44
- '7.1.18'
55
- '7.2'
6+
- nightly
67
- 'hhvm'
8+
matrix:
9+
allow_failures:
10+
- php: nightly
711
install:
8-
- composer update
12+
- composer install
913
script:
1014
- ./vendor/bin/phpunit --coverage-clover ./tests/Logs/clover.xml
1115
- ./vendor/bin/psalm
1216
after_script:
13-
- php vendor/bin/php-coveralls -v
17+
- php vendor/bin/php-coveralls -v

composer.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010
],
1111
"require-dev": {
12-
"phpunit/phpunit": "^5.7",
12+
"phpunit/phpunit": "^6.5",
1313
"fzaninotto/faker": "^1.7",
1414
"vimeo/psalm": "^1",
1515
"php-coveralls/php-coveralls": "^2.1"
@@ -22,6 +22,11 @@
2222
"src/PasswordExposedFunction.php"
2323
]
2424
},
25+
"autoload-dev": {
26+
"psr-4": {
27+
"DivineOmega\\PasswordExposed\\Tests\\": "tests/"
28+
}
29+
},
2530
"license": "LGPL-3.0-only",
2631
"require": {
2732
"php": ">=5.6",

tests/Unit/BundleInjectionTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
namespace DivineOmega\PasswordExposed\Tests;
4+
35
use DivineOmega\PasswordExposed\PasswordExposedChecker;
46
use DivineOmega\PasswordExposed\PasswordStatus;
57
use ParagonIE\Certainty\Bundle;

tests/Unit/PasswordExposedTest.php

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<?php
22

3+
namespace DivineOmega\PasswordExposed\Tests;
4+
35
use DivineOmega\PasswordExposed\PasswordStatus;
6+
use Faker\Factory;
47
use PHPUnit\Framework\TestCase;
58

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

13-
public function testExposedPasswords()
16+
public function exposedPasswordsProvider()
1417
{
15-
$passwords = ['test', 'password', 'hunter2'];
18+
return [
19+
['test'],
20+
['password'],
21+
['hunter2'],
22+
];
23+
}
1624

17-
foreach ($passwords as $password) {
18-
$this->assertEquals(password_exposed($password), PasswordStatus::EXPOSED);
19-
}
25+
/**
26+
* @dataProvider exposedPasswordsProvider
27+
*/
28+
public function testExposedPasswords($password)
29+
{
30+
$this->assertEquals(password_exposed($password), PasswordStatus::EXPOSED);
2031
}
2132

2233
public function testNotExposedPasswords()
@@ -26,7 +37,7 @@ public function testNotExposedPasswords()
2637

2738
private function getPasswordUnlikelyToBeExposed()
2839
{
29-
$faker = Faker\Factory::create();
40+
$faker = Factory::create();
3041

3142
$password = '';
3243

0 commit comments

Comments
 (0)