The branch, master has been updated
via 74764f3cf1c238fed2cdb29e62fb59bbcf771c69 (commit)
via 7654af9632d9f56a791a3019a41624aca3a16ed7 (commit)
from 670b6ea38b626750bd7ceaee393542e461d04c2b (commit)
- Log -----------------------------------------------------------------
commit 74764f3cf1c238fed2cdb29e62fb59bbcf771c69
Author: Michal Čihař <[email protected]>
Date: Mon Aug 15 11:24:22 2011 +0200
Add test case for failed eval
commit 7654af9632d9f56a791a3019a41624aca3a16ed7
Author: Michal Čihař <[email protected]>
Date: Mon Aug 15 11:21:38 2011 +0200
Add test for errors
-----------------------------------------------------------------------
Summary of changes:
test/classes/Advisor_test.php | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/test/classes/Advisor_test.php b/test/classes/Advisor_test.php
index d5d9dda..d2be774 100644
--- a/test/classes/Advisor_test.php
+++ b/test/classes/Advisor_test.php
@@ -50,17 +50,19 @@ class Advisor_test extends PHPUnit_Framework_TestCase
* @depends testParse
* @dataProvider rulesProvider
*/
- public function testAddRule($rule, $expected)
+ public function testAddRule($rule, $expected, $error)
{
$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());
+ if (isset($advisor->runResult['errors']) || !is_null($error)) {
+ $this->assertEquals($advisor->runResult['errors'], array($error));
+ }
+ if (isset($advisor->runResult['fired']) || $expected != array()) {
+ $this->assertEquals($advisor->runResult['fired'],
array($expected));
}
- $this->assertEquals($advisor->runResult['fired'], array($expected));
}
public function rulesProvider()
@@ -69,22 +71,32 @@ class Advisor_test extends PHPUnit_Framework_TestCase
array(
array('justification' => 'foo', 'name' => 'Basic', 'issue' =>
'issue', 'recommendation' => 'Recommend'),
array('justification' => 'foo', 'name' => 'Basic', 'issue' =>
'issue', 'recommendation' => 'Recommend'),
+ null,
),
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?lang=en&token=token#filter=status_var">status_var</a>'),
+ null,
),
array(
array('justification' => '%s foo | value', 'name' => 'Format',
'issue' => 'issue', 'recommendation' => 'Recommend'),
array('justification' => '0 foo', 'name' => 'Format', 'issue'
=> 'issue', 'recommendation' => 'Recommend'),
+ null,
),
array(
array('justification' => '%s% foo | value', 'name' =>
'Percent', 'issue' => 'issue', 'recommendation' => 'Recommend'),
array('justification' => '0% foo', 'name' => 'Percent',
'issue' => 'issue', 'recommendation' => 'Recommend'),
+ null,
),
array(
array('justification' => '"\'foo', 'name' => 'Quotes', 'issue'
=> 'issue', 'recommendation' => 'Recommend"\''),
array('justification' => '"\'foo', 'name' => 'Quotes', 'issue'
=> 'issue', 'recommendation' => 'Recommend"\''),
+ null,
+ ),
+ array(
+ array('justification' => 'foo | fsafdsa', 'name' => 'Failure',
'issue' => 'issue', 'recommendation' => 'Recommend'),
+ array(),
+ 'Failed formattingstring for rule \'Failure\'. PHP threw
following error: Use of undefined constant fsafdsa - assumed \'fsafdsa\'',
),
);
}
hooks/post-receive
--
phpMyAdmin
------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model
configuration take the hassle out of deploying and managing Subversion and
the tools developers use with it. Learn more about uberSVN and get a free
download at: http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Phpmyadmin-git mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-git