Пример #1
0
 function testCommonValues()
 {
     $profile = array('trace' => 1, 'connection_timeout' => 10, 'exceptions' => 1);
     jProfiles::createVirtualProfile('acme', '__common__', $profile);
     $profile = array('wsdl' => "http://example.com/wsdl1", 'connection_timeout' => 25);
     jProfiles::createVirtualProfile('acme', 'foo', $profile);
     $p = jProfiles::get('acme', 'foo');
     $expected = array('trace' => 1, 'exceptions' => 1, 'connection_timeout' => 25, 'wsdl' => "http://example.com/wsdl1", '_name' => 'foo');
     $this->assertEquals($expected, $p);
 }
Пример #2
0
 function getTests()
 {
     try {
         $prof = jProfiles::get('jdb', $this->dbProfile, true);
     } catch (Exception $e) {
         $this->sendMessage('UTjDbPgsql cannot be run: ' . $e->getMessage());
         return array();
     }
     return parent::getTests();
 }
Пример #3
0
 protected function loadProfile()
 {
     try {
         jProfiles::get('jcache', 'jforms', true);
     } catch (Exception $e) {
         // no profile, let's create a default profile
         $cacheDir = jApp::tempPath('jforms');
         jFile::createDir($cacheDir);
         $params = array('enabled' => 1, 'driver' => 'file', 'ttl' => 3600 * 48, 'automatic_cleaning_factor' => 3, 'cache_dir' => $cacheDir, 'directory_level' => 3);
         jProfiles::createVirtualProfile('jcache', 'jforms', $params);
     }
 }
Пример #4
0
 function __construct($sel, $profile)
 {
     $p = jProfiles::get('jdb', $profile);
     if ($p['driver'] == 'pdo') {
         $this->driver = substr($p['dsn'], 0, strpos($p['dsn'], ':'));
     } else {
         $this->driver = $p['driver'];
     }
     $this->dbType = $p['dbtype'];
     $this->_compiler = 'jDaoCompiler';
     $this->_compilerPath = JELIX_LIB_PATH . 'dao/jDaoCompiler.class.php';
     parent::__construct($sel);
 }
Пример #5
0
 function testCall()
 {
     try {
         $profile = jProfiles::get("jsoapclient");
         if (!isset($profile['wsdl']) || $profile['wsdl'] == '') {
             $this->markTestSkipped('no wsdl specified in profile for jSoapClient. cannot test jSoapClient::get()');
             return;
         }
     } catch (Exception $e) {
         $this->markTestSkipped('no profile for jSoapClient. cannot test jSoapClient::get()');
         return;
     }
     $client = jSoapClient::get();
     $result = $client->hello('Sylvain');
     $this->assertEquals("Hello Sylvain", $result);
     $result = $client->__soapCall('hello', array('Sylvain'));
     $this->assertEquals("Hello Sylvain", $result);
 }
Пример #6
0
    function testTools()
    {
        try {
            $profile = jProfiles::get('jdb', 'testapp_sqlite', true);
        } catch (Exception $e) {
            $this->sendMessage("UTjDbSqlite cannot be run : no sqlite profile");
            return;
        }
        $tools = jDb::getConnection('testapp_sqlite')->tools();
        $fields = $tools->getFieldList('products');
        $structure = '<array>
    <object key="id" class="jDbFieldProperties">
        <string property="type" value="integer" />
        <string property="name" value="id" />
        <boolean property="notNull" value="true" />
        <boolean property="primary" value="true" />
        <boolean property="autoIncrement" value="true" />
        <boolean property="hasDefault" value="false" />
        <string property="default" value="" />
        <integer property="length" value="0" />
    </object>
    <object key="name" class="jDbFieldProperties">
        <string property="type" value="varchar" />
        <string property="name" value="name" />
        <boolean property="notNull" value="true" />
        <boolean property="primary" value="false" />
        <boolean property="autoIncrement" value="false" />
        <boolean property="hasDefault" value="false" />
        <string property="default" value="" />
        <integer property="length" value="150" />
    </object>
    <object key="price" class="jDbFieldProperties">
        <string property="type" value="float" />
        <string property="name" value="price" />
        <boolean property="notNull" value="false" />
        <boolean property="primary" value="false" />
        <boolean property="autoIncrement" value="false" />
        <boolean property="hasDefault" value="true" />
        <string property="default" value="0" />
        <integer property="length" value="0" />
    </object>
</array>';
        $this->assertComplexIdenticalStr($fields, $structure, 'bad results');
    }
Пример #7
0
 function install()
 {
     if (!$this->firstDbExec()) {
         return;
     }
     $this->execSQLScript('install');
     //Create tables if they do not exist yet because of a specific configuration
     //(which is the case of testapp's out of the box config)
     $this->execSQLScript('sql/install_jsession.schema', 'jelix');
     $this->execSQLScript('sql/install_jcache.schema', 'jelix');
     try {
         $dbprofile = jProfiles::get('jdb', 'testapp_pgsql', true);
         $this->useDbProfile('testapp_pgsql');
     } catch (Exception $e) {
         // no profile for pgsql, don't install tables in pgsql
         return;
     }
     $this->execSQLScript('install');
     $this->execSQLScript('sql/install_jsession.schema', 'jelix');
 }
Пример #8
0
 public static function getProfile($name = '', $noDefault = false)
 {
     return jProfiles::get('jdb', $name, $noDefault);
 }
Пример #9
0
 public static function getProfile($name = null)
 {
     return jProfiles::get('jkvdb', $name);
 }
Пример #10
0
 protected function getDbType($profile = null)
 {
     if (!$profile) {
         $profile = $this->dbProfile;
     }
     $p = jProfiles::get('jdb', $profile);
     $driver = $p['driver'];
     if ($driver == 'pdo') {
         preg_match('/^(\\w+)\\:.*$/', $p['dsn'], $m);
         $driver = $m[1];
     }
     return $driver;
 }