[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_3_2-14993-ge4c101c

Michal Čihař nijel at users.sourceforge.net
Mon Aug 15 11:02:58 CEST 2011


The branch, master has been updated
       via  e4c101c4d64ca3d63601c84b26b4c1be82f57f81 (commit)
       via  9889e68133fa209d961d1aea8a9cd51451af6f38 (commit)
      from  72f9042b9ae715b912057934bdbc061a2444ff65 (commit)


- Log -----------------------------------------------------------------
commit e4c101c4d64ca3d63601c84b26b4c1be82f57f81
Author: Michal Čihař <mcihar at suse.cz>
Date:   Mon Aug 15 11:02:39 2011 +0200

    Add more cases for adding rules

commit 9889e68133fa209d961d1aea8a9cd51451af6f38
Author: Michal Čihař <mcihar at suse.cz>
Date:   Mon Aug 15 10:54:53 2011 +0200

    Add testcase for adding rules

-----------------------------------------------------------------------

Summary of changes:
 test/classes/Advisor_test.php |   47 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/test/classes/Advisor_test.php b/test/classes/Advisor_test.php
index 2bc0e68..24b8fe6 100644
--- a/test/classes/Advisor_test.php
+++ b/test/classes/Advisor_test.php
@@ -10,9 +10,17 @@
  * Include to test.
  */
 require_once 'libraries/Advisor.class.php';
+require_once 'libraries/php-gettext/gettext.inc';
+require_once 'libraries/url_generating.lib.php';
+require_once 'libraries/core.lib.php';
 
 class Advisor_test extends PHPUnit_Framework_TestCase
 {
+    public function setup()
+    {
+        $_SESSION[' PMA_token '] = 'token';
+    }
+
     /**
      * @dataProvider escapeStrings
      */
@@ -36,5 +44,44 @@ class Advisor_test extends PHPUnit_Framework_TestCase
         $parseResult = $advisor->parseRulesFile();
         $this->assertEquals($parseResult['errors'], array());
     }
+
+    /**
+     * @depends testParse
+     * @dataProvider rulesProvider
+     */
+    public function testAddRule($rule, $expected)
+    {
+        $advisor = new Advisor();
+        $parseResult = $advisor->parseRulesFile();
+        $this->assertEquals($parseResult['errors'], array());
+        $advisor->variables['value'] = 0;
+        $advisor->addRule('fired', $rule);
+        if (isset($advisor->runResult['errors'])) {
+            $this->assertEquals($advisor->runResult['errors'], array());
+        }
+        $this->assertEquals($advisor->runResult['fired'], array($expected));
+    }
+
+    public function rulesProvider()
+    {
+        return array(
+            array(
+                array('justification' => 'foo', 'name' => 'Basic', 'issue' => 'issue', 'recommendation' => 'Recommend'),
+                array('justification' => 'foo', 'name' => 'Basic', 'issue' => 'issue', 'recommendation' => 'Recommend'),
+            ),
+            array(
+                array('justification' => 'foo', 'name' => 'Variable', 'issue' => 'issue', 'recommendation' => 'Recommend {status_var}'),
+                array('justification' => 'foo', 'name' => 'Variable', 'issue' => 'issue', 'recommendation' => 'Recommend <a href="server_variables.php?token=token#filter=status_var">status_var</a>'),
+            ),
+            array(
+                array('justification' => '%s foo | value', 'name' => 'Format', 'issue' => 'issue', 'recommendation' => 'Recommend'),
+                array('justification' => '0 foo', 'name' => 'Format', 'issue' => 'issue', 'recommendation' => 'Recommend'),
+            ),
+            array(
+                array('justification' => '%s% foo | value', 'name' => 'Percent', 'issue' => 'issue', 'recommendation' => 'Recommend'),
+                array('justification' => '0% foo', 'name' => 'Percent', 'issue' => 'issue', 'recommendation' => 'Recommend'),
+            ),
+        );
+    }
 }
 ?>


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list