8 Commits

Author SHA1 Message Date
c906fef5c8 FIX: last ignore 2021-02-09 17:39:57 -03:00
6fe036f3cd Add results to ignore 2021-02-09 17:38:08 -03:00
f32e775191 PHPUnit config 2021-02-09 17:38:08 -03:00
35faeff1c9 Update tests 2021-02-09 17:38:08 -03:00
e1cfbbc7ae Initial tests 2021-02-09 17:38:08 -03:00
a9b235d3e1 FIX: static property 2021-02-09 17:37:58 -03:00
237cca1287 Added Carbon to dependencies 2021-02-09 17:37:42 -03:00
0eb8eb2800 Release dependency from aldarien/contract 2021-02-09 17:25:17 -03:00
6 changed files with 41 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
# Composer # Composer
/vendor/ /vendor/
composer.lock composer.lock
# PHPUnit
.phpunit.result.*

View File

@ -1,17 +1,21 @@
<?php <?php
namespace App\Contract; namespace App\Contract;
use App\Definition\Contract;
use App\Service\Auth as AuthService; use App\Service\Auth as AuthService;
class Auth class Auth
{ {
use Contract;
protected static function newInstance() protected static function newInstance()
{ {
return new AuthService(); return new AuthService();
} }
protected static $instance;
protected static function getInstance() {
if (self::$instance === null) {
self::$instance = self::newInstance();
}
return self::$instance;
}
public static function __callStatic($name, $params) public static function __callStatic($name, $params)
{ {
if (!method_exists(Response::class, $name)) { if (!method_exists(Response::class, $name)) {
@ -24,4 +28,4 @@ class Auth
return call_user_func_array([self, $name], $params); return call_user_func_array([self, $name], $params);
} }
} }
?> ?>

View File

@ -10,7 +10,7 @@
} }
], ],
"require": { "require": {
"aldarien/contract": "^1" "nesbot/carbon": "^2.45"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^8" "phpunit/phpunit": "^8"

10
phpunit.xml Normal file
View File

@ -0,0 +1,10 @@
<phpunit
colors="true"
verbose="true"
>
<testsuites>
<testsuite name="Config Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

9
tests/ContractTest.php Normal file
View File

@ -0,0 +1,9 @@
<?php
use PHPUnit\Framework\TestCase;
use App\contract\Auth;
class ContractTest extends TestCase {
public function testContract() {
Auth::logout();
}
}

10
tests/ServiceTest.php Normal file
View File

@ -0,0 +1,10 @@
<?php
use PHPUnit\Framework\TestCase;
use App\Service\Auth;
class ServiceTest extends TestCase {
public function testLoad() {
$this->service = new Auth();
$this->assertTrue($this->service != false);
}
}