developer.jelix.org is not used any more and exists only for history. Post new tickets on the Github account.
developer.jelix.org n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #856: 856-testapp-pgsql-tests-fail.2.diff

File 856-testapp-pgsql-tests-fail.2.diff, 2.8 KB (added by Julien, 12 years ago)

I think it's far better that way ;)

  • testapp/modules/jelix_tests/tests/jdb.pgsql.html_cli.php

     
    1111
    1212class UTjDbPgsql extends jUnitTestCaseDb {
    1313    protected $dbProfile ='testapp_pgsql';
    14    
     14
     15    function getTests(){
     16        try{
     17            $profile = jDb::getConnection($this->dbProfile);
     18        }
     19        catch (Exception $e) {
     20            $this->sendMessage('UTjDbPgsql cannot be run: '.$e->getMessage());
     21            return array();
     22        }
     23        return parent::getTests();
     24    }
     25
    1526    function testStart() {
    1627        $this->emptyTable('product_test');
    1728    }
    1829
    1930    function testTools(){
    20         try {
    21             $profile = jDb::getProfile($this->dbProfile);
    22             $tools = jDb::getTools($this->dbProfile);
    23         } catch (Exception $e) {
    24             $this->sendMessage("UTjDbPgsql cannot be run : no postgresql connexion");
    25             return;
    26         }
     31        $tools = jDb::getTools($this->dbProfile);
    2732
    2833        $fields = $tools->getFieldList('products');
    2934        $structure = '<array>
     
    142147        $prod->id = $this->prod1->id;
    143148
    144149        $dao->update($prod);
    145        
     150
    146151        $prod2 = $dao->get($this->prod1->id);
    147152        $this->assertTrue($prod2 instanceof jDaoRecordBase,'jDao::get doesn\'t return a jDaoRecordBase object');
    148153        $this->assertEqual($prod2->id, $this->prod1->id, 'jDao::get : bad id on record');
    149154        $this->assertEqual($prod2->name,'assiette nouvelle', 'jDao::get : bad name property on record');
    150155        $this->assertEqual($prod2->price,5.90, 'jDao::get : bad price property on record');
    151156        $this->assertEqual($prod2->promo,'t', 'jDao::get : bad promo property on record');
    152        
    153        
     157
     158
    154159        $prod->promo = 't';
    155160        $dao->update($prod);
    156161        $prod2 = $dao->get($this->prod1->id);
    157162        $this->assertEqual($prod2->promo,'t', 'jDao::get : bad promo property on record : %');
    158        
     163
    159164        $prod->promo = 1;
    160165        $dao->update($prod);
    161166        $prod2 = $dao->get($this->prod1->id);
    162167        $this->assertEqual($prod2->promo,'t', 'jDao::get : bad promo property on record : %');
    163        
     168
    164169        $prod->promo = 'f';
    165170        $dao->update($prod);
    166171        $prod2 = $dao->get($this->prod1->id);
     
    170175        $dao->update($prod);
    171176        $prod2 = $dao->get($this->prod1->id);
    172177        $this->assertEqual($prod2->promo,'f', 'jDao::get : bad promo property on record : %');
    173        
     178
    174179        $prod->promo = 0;
    175180        $dao->update($prod);
    176181        $prod2 = $dao->get($this->prod1->id);
    177182        $this->assertEqual($prod2->promo,'f', 'jDao::get : bad promo property on record : %');
    178        
     183
    179184    }
    180185
    181186}