Adds tests
This commit is contained in:
+3
-1
@@ -13,5 +13,7 @@
|
||||
"Kavalanche\\Security\\": "src/"
|
||||
}
|
||||
},
|
||||
"require": {}
|
||||
"require": {
|
||||
"phpunit/phpunit": "^8.4"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+1535
File diff suppressed because it is too large
Load Diff
+22
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/8.4/phpunit.xsd"
|
||||
bootstrap="vendor/autoload.php"
|
||||
executionOrder="depends,defects"
|
||||
forceCoversAnnotation="true"
|
||||
beStrictAboutCoversAnnotation="true"
|
||||
beStrictAboutOutputDuringTests="true"
|
||||
beStrictAboutTodoAnnotatedTests="true"
|
||||
verbose="true">
|
||||
<testsuites>
|
||||
<testsuite name="default">
|
||||
<directory suffix="Test.php">tests</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist processUncoveredFilesFromWhitelist="true">
|
||||
<directory suffix=".php">src</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
class InMemoryUserProviderTest extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function testLoadUserByUsername_throwsOnError() {
|
||||
$this->expectException(Exception::class);
|
||||
|
||||
$userProvider = new \Kavalanche\Security\InMemoryUserProvider();
|
||||
$userProvider->loadUserByUsername('Kasia');
|
||||
}
|
||||
|
||||
public function testLoadUserByUsername_returnsUser() {
|
||||
$userProvider = new \Kavalanche\Security\InMemoryUserProvider();
|
||||
$user = $userProvider->loadUserByUsername('Wojtek');
|
||||
$this->assertInstanceOf(\Kavalanche\Security\UserInterface::class, $user);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user