コード例 #1
0
ファイル: auth_Test.php プロジェクト: stripTM/acd
<?php

namespace Acd;

include_once DIR_BASE . '/app/model/Auth.php';
// Set  routes to data tests
\Acd\conf::$PATH_AUTH_CREDENTIALS_FILE = DIR_TEST . '/data/auth.json';
\Acd\conf::$PATH_AUTH_PREMANENT_LOGIN_DIR = DIR_TEST . '/data/auth_permanent_login';
class auth_Test extends \PHPUnit_Framework_TestCase
{
    // ...
    public function testSetData()
    {
        $aCredentials = Model\Auth::loginByCredentials('fer', 'fer', false);
        $this->assertTrue(Model\Auth::loginByCredentials('test_user', 'fer', false));
        //$this->assertTrue(Model\Auth::loginByCredentials('Fer', 'fer', true));
        $this->assertFalse(Model\Auth::loginByCredentials('bad_test_user', 'fer', false));
        $this->assertTrue(Model\Auth::loginByPersintence('test_user', '940e9aac0d740736b18be249a04e518343855a5a'));
        $this->assertFalse(Model\Auth::loginByPersintence('fer', 'fer'));
    }
}
コード例 #2
0
ファイル: tools_ou_Test.php プロジェクト: stripTM/acd
<?php

namespace Acd;

include_once DIR_BASE . '/app/view/Tools.php';
\Acd\conf::$PATH_AUTH_CREDENTIALS_FILE = DIR_TEST . '/data/auth.json';
\Acd\conf::$DIR_TEMPLATES = DIR_TEST . '/data/tools/';
class tools_ou_test extends \PHPUnit_Framework_TestCase
{
    // ...
    public function testSetData()
    {
        $tools = new View\Tools();
        $aCredentials = Model\Auth::getCredentials('test_user');
        //var_dump($aCredentials);
        $this->assertEquals($tools->render(), '<strong>Tools</strong>');
    }
}