64 lines
1.3 KiB
PHP
64 lines
1.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Honza
|
|
* Date: 21/7/16
|
|
* Time: 9:47 AM.
|
|
*/
|
|
class AliveTest extends DatabaseTestCase
|
|
{
|
|
public static function setUpBeforeClass(): void
|
|
{
|
|
if (!findModule('alive')) {
|
|
self::markTestSkipped('Modul alive je vypnutý.');
|
|
}
|
|
}
|
|
|
|
public function testConnect()
|
|
{
|
|
$aliveCard = new AliveCard();
|
|
|
|
$connection = $aliveCard->connect();
|
|
|
|
$this->assertNotFalse($connection);
|
|
}
|
|
|
|
public function testTestServer()
|
|
{
|
|
global $cfg;
|
|
|
|
$old_cfg = $cfg;
|
|
|
|
$cfg['Modules']['isic'] = [
|
|
'url' => 'https://gts-dm.orchitech.net/api',
|
|
'username' => 'testdm',
|
|
'password' => 'testdm',
|
|
];
|
|
$name = 'Přemysll Žluťoučký';
|
|
$card = 'T042532100344J';
|
|
|
|
$aliveCard = new AliveCard();
|
|
|
|
$info = $aliveCard->validate($card, $name);
|
|
|
|
$cfg = $old_cfg;
|
|
$this->assertNotFalse($info);
|
|
}
|
|
|
|
public function testRealServer()
|
|
{
|
|
$name = 'PROKOP Jan';
|
|
$card = 'S420562002829G';
|
|
|
|
// $name = "Jakub Jirouš";
|
|
// $card = "S420562000568G";
|
|
|
|
$aliveCard = new AliveCard();
|
|
|
|
$info = $aliveCard->validate($card, $name);
|
|
|
|
$this->assertNotFalse($info);
|
|
}
|
|
}
|