Forum Replies Created

Viewing 15 replies - 1 through 15 (of 26 total)
  • Plugin Contributor osfans

    (@osfans)

    It works!
    So you test scale max and length instead of min.

    Thanks!

    Plugin Contributor osfans

    (@osfans)

    It seems that I have to create a TestTest.php instead of adding a testcase in ScaleTest.php.

    A big project! I’m not sure I can manage it.

    Plugin Contributor osfans

    (@osfans)

    So I will do as follows:

    1. start a new feature from develop
    2. try to fix and test.
    3. finish the new feature and merge into develop
    4. create PR

    Is it the right workflow of merging a new feature?

    Plugin Contributor osfans

    (@osfans)

    I’ve never use ‘git flow’, and never wonder git could works in such a nice way. I’ll have a try.
    Too many things(php, phpunit & git flow) to study.

    Thanks!

    Plugin Contributor osfans

    (@osfans)

    Finally, it works after I install wordpress and wp-testing locally.
    And set database in db/ruckusing.conf.php.
    Is it OK?

    kyle@~/prj/wp/wp-testing % vendor/bin/phpunit-php52
    PHPUnit @package_version@ by Sebastian Bergmann.

    Configuration read from /home/kyle/prj/wp/wp-testing/phpunit.xml.dist

    ……………………………………….

    Time: 0 seconds, Memory: 7.75Mb

    OK (46 tests, 65 assertions)

    Plugin Contributor osfans

    (@osfans)

    I’ve downloaded the repo with proxy.

    But there’s an error and I can find the function in vendor/phpunit/phpunit-php52/PHPUnit/Util/Filesystem.php

    kyle@~/prj/wp/wp-testing % phpunit
    PHP Fatal error: Call to undefined method PHPUnit_Util_Filesystem::fileExistsInIncludePath() in /home/kyle/prj/wp/wp-testing/vendor/phpunit/phpunit-php52/PHPUnit/Autoload.php on line 209

    Hi prosunsen,
    I send you a Chinese translation.

    Plugin Contributor osfans

    (@osfans)

    Sorry, I have to give up phpunit because of my network.

    Failed: [Symfony\Component\Process\Exception\ProcessTimedOutException] The process “git clone –no-checkout ‘git://github.com/garex/phpunit’ ‘/home/kyle/prj/wp-testing/vendor/phpunit/phpunit-php52’ && cd ‘/home/kyle/prj/wp-testing/vendor/phpunit/phpunit-php52’ && git remote add composer ‘git://github.com/garex/phpunit’ && git fetch composer” exceeded the timeout of 300 seconds.

    Plugin Contributor osfans

    (@osfans)

    OK, I’ll have a try.
    I use arch linux.

    Plugin Contributor osfans

    (@osfans)

    But I don’t know how to run phpunit. Error happens:

    PHP Warning: require_once(/home/osfans/prj/wp-testing/tests/phpunit/../../vendor/autoload_52.php): failed to open stream: No such file or directory in /home/osfans/prj/wp-testing/tests/phpunit/bootstrap.php on line 2

    I fix the bug as follows.

    diff --git a/db/sql/scale-max-right.sql b/db/sql/scale-max-right.sql
    index 451aba0..6a9e197 100644
    --- a/db/sql/scale-max-right.sql
    +++ b/db/sql/scale-max-right.sql
    @@ -1,6 +1,6 @@
     SELECT
            scale_id,
    -       MIN(minimum_in_row) AS minimum_in_column,
    +       SUM(minimum_in_row) AS minimum_in_column,
            SUM(maximum_in_row) AS maximum_in_column,
            SUM(sum_in_row)     AS sum_in_column
     FROM (
    diff --git a/src/Model/Test.php b/src/Model/Test.php
    index 7777fa4..943aa95 100644
    --- a/src/Model/Test.php
    +++ b/src/Model/Test.php
    @@ -93,7 +93,7 @@ class WpTesting_Model_Test extends WpTesting_Model_AbstractModel
             $result       = $db->translatedQuery('
                 SELECT
                     scale_id,
    -                MIN(minimum_in_row) AS minimum_in_column,
    +                SUM(minimum_in_row) AS minimum_in_column,
                     SUM(maximum_in_row) AS maximum_in_column,
                     SUM(sum_in_row)     AS sum_in_column
                 FROM (

    Plugin Contributor osfans

    (@osfans)

    I’m not sure of the meaning of PR. So what does PR mean?

    Plugin Contributor osfans

    (@osfans)

    Here’s a simple test case (1 scale(X), 2 questions(Q1 Q2) and 2 answers(Y N))

    Q1:1 -1
    Q2:1 -1

    When I choose N for Q1 and Q2, exception happens in setValue and no result shows.

    Scale value -2 must be within range from -1 to 2

    Plugin Contributor osfans

    (@osfans)

    I think the minimum should be the sum of every min score, not the min of all scores, since the value here is the sum score of a scale.

    I comment out these lines and the result page appears.

    if (!($this->minimum <= $value) || !($value <= $this->maximum)) {
        throw new InvalidArgumentException('Scale value ' . $value . ' must be within range from ' . $this->minimum . ' to ' . $this->maximum);
    }
    Plugin Contributor osfans

    (@osfans)

    It seems to be caused by SQL in buildScalesWithRange()

    1. There are 8 questions, 4 answers(ABCD) and 3 scales(XYZ).

    1. X: 2 1 -1 -2
    2. X: 2 1 -1 -2
    3. X: 2 1 -1 -2
    4. X: 2 1 -1 -2
    5. Y: -4 -2 0 2
    6. Y: -1 0 1 2
    7. Y: -4 -2 2 4
    8. Z: -8 -4 4 8

    So,
    sum(min(X))=-8
    sum(min(Y))=-9
    sum(min(Z))=-8

    3. My debug code:

    public function setValue($value)
        {
            $value = $this->filterValue($value, 'value');
            echo('Scale value ' . $value . ' must be within range from ' . $this->minimum . ' to ' . $this->maximum."\n");
            if (!($this->minimum <= $value) || !($value <= $this->maximum)) {
                throw new InvalidArgumentException('Scale value ' . $value . ' must be within range from ' . $this->minimum . ' to ' . $this->maximum);
            }
            $this->value = $value;
            return $this;
        }
    Plugin Contributor osfans

    (@osfans)

    Maybe there could be a source-code edit mode besides GUI mode.
    In the mode, we can reorder questions, modify formula, customize result description, etc.

Viewing 15 replies - 1 through 15 (of 26 total)