Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
dergel committed Sep 23, 2023
1 parent 76ece77 commit 3c77a01
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
"scripts": {
"cs-dry": "php-cs-fixer fix -v --ansi --dry-run --config=.php-cs-fixer.dist.php",
"cs-fix": "php-cs-fixer fix -v --ansi --config=.php-cs-fixer.dist.php",
"test": "phpunit --testdox -vvv"
"test": "phpunit --testdox"
}
}
2 changes: 1 addition & 1 deletion lib/ycom_log.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function log($user, string $type = '', array $params = []): void
return;
}

$ip = $_SERVER['REMOTE_ADDR'];
$ip = $_SERVER['REMOTE_ADDR'] ?? '';
if (isset($_SERVER['HTTP_CLIENT_IP'])) {
$ip = (string) $_SERVER['HTTP_CLIENT_IP'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
Expand Down
24 changes: 24 additions & 0 deletions tests/unit/login_test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

use PHPUnit\Framework\TestCase;

/**
* @internal
*/
class rex_ycom_login_test extends TestCase
{
public function testLogin()
{
$params = [
'loginName' => 'admin',
'loginPassword' => 'admin',
'filter' => [],
'loginStay' => false,
'ignorePassword' => false,
];

$status = rex_ycom_auth::login($params);
static::assertEquals(rex_ycom_auth::STATUS_LOGIN_FAILED, $status);

}
}

0 comments on commit 3c77a01

Please sign in to comment.