Ticket #1397 (closed bug: fixed)

Opened 23 months ago

Last modified 11 months ago

testapp : UTjDbSchemaMysql -> testTable seems to be wrong

Reported by: bricet Owned by: bricet
Priority: normal Milestone: Jelix 1.3.3
Component: app:testapp Version: 1.2.3
Severity: normal Keywords:
Cc: Php version: PHP 5.3.6-12 with Suhosin-Patch
Hosting Provider: Blocked By:
Documentation needed: no Blocking:

Description

It seems there is just a small bug in testapp for an assertComplexIdenticalStr()

Here is a (small) patch

Attachments

patch_1397.diff Download (0.7 KB) - added by bricet 23 months ago.
patch_1397_bis.diff Download (1.8 KB) - added by bricet 23 months ago.

Change History

Changed 23 months ago by bricet

Changed 23 months ago by laurentj

Pas de problème chez moi. ça doit venir d'une version de mysql spécifique..

Changed 23 months ago by bricet

Je dirais que c'est plutôt un problème de version de PHP.

A priori un comportement différent de SimpleTestCompatibility::isA()

Changed 23 months ago by bricet

  • phpversion set to PHP 5.3.6-12 with Suhosin-Patch

Je confirme plutôt penser à un problème de version de PHP.

De toute façon, il me semble étrange d'estimer que -2147483648 soit un double.

J'ai spotté exactement ce qui me retourne l'erreur : c'est IsAExpectation::test()

strtolower(gettype(-2147483648)) me retourne 'integer' et non 'double'

Je suis en "PHP 5.3.6-12 with Suhosin-Patch" (sur linux amd64)

Le message d'erreur que j'ai pour le test unitaire est :

Fail: /home/brice/dev/jelix/fork/compiled/testapp/modules/jelix_tests/tests/jdbschema.mysql.html_cli.php -> UTjDbSchemaMysql -> testTable -> $value[id]->minValue: not a float (-2147483648) at [/home/brice/dev/jelix/fork/compiled/testapp/modules/jelix_tests/tests/jdbschema.mysql.html_cli.php line 132]
Fail: /home/brice/dev/jelix/fork/compiled/testapp/modules/jelix_tests/tests/jdbschema.mysql.html_cli.php -> UTjDbSchemaMysql -> testTable -> $value[id] : non identical objects at [/home/brice/dev/jelix/fork/compiled/testapp/modules/jelix_tests/tests/jdbschema.mysql.html_cli.php line 132]

Changed 23 months ago by bricet

D'ailleurs dans simpletest 1.1a3 cette méthode a été modifiée - et ça semble en accord avec le doc PHP de gettype(), qui semble déconseillée.

Code que l'on a dans IsAExpectation::test() :

        if (is_object($compare)) {
            return SimpleTestCompatibility::isA($compare, $this->type);
        } else {
            return (strtolower(gettype($compare)) == $this->canonicalType($this->type));
        }

Code dans 1.1a3 :

        if (is_object($compare)) {
            return SimpleTestCompatibility::isA($compare, $this->type);
        } else {
            $function = 'is_'.$this->canonicalType($this->type);
            if (is_callable($function)) {
                return $function($compare);
            }
            return false;
        }

En faisant cette modif chez moi, on peut mettre, semble-t-il, indifférement integer ou double. Par contre, ça impliquerait pas mal de modif du bout de XML auquel je touche dans mon patch. Un avis ?

Changed 23 months ago by bricet

Here is another patch, taking some code from simpletest 1.1a3

Changed 23 months ago by bricet

Changed 23 months ago by bricet

Et donc je me suis trompé : on n'a pas besoin de toucher au XML (mis à part double->integer, qui me semble plus propre même si pas nécessaire)

Changed 17 months ago by laurentj

  • owner changed from laurentj to bricet
  • status changed from new to reviewing
  • review review? deleted

Changed 17 months ago by laurentj

  • status changed from reviewing to assigned
  • milestone set to Jelix 1.3.2

Upgrade to simpletest 1.1a3 is done.  https://github.com/jelix/jelix/commit/f9f22b0461166d28185ea59f0f0299d04a518c28

mis à part double->integer, qui me semble plus propre même si pas nécessaire)

Oui mais en 32bits, le nombre dépasse la taille maximal, donc transformation en double. À vérifier si <double> passe aussi pour les tests en 64bits.

Changed 11 months ago by bricet

Anéfé sur 64bits, le test ne passe pas en double. Il passe en integer. Je n'ai pas poussé la reflexion plus loin pour le moment ..

Changed 11 months ago by laurentj

  • status changed from assigned to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.