Started unit tests for condition and argument classes.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8577 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ucorina 2011-07-07 14:34:56 +00:00
parent 7112d518c8
commit 76019a4b2b
15 changed files with 537 additions and 108 deletions

View file

@ -0,0 +1,232 @@
<?php
/**
* Test class for Argument.
* Generated by PHPUnit on 2011-07-07 at 16:51:29.
*/
class ArgumentTest extends CubridTest {
/**
* @todo Implement testGetType().
*/
public function testGetType() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testSetColumnType().
*/
public function testSetColumnType() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGetName().
*/
public function testGetName() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGetValue().
*/
public function testGetValue() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGetUnescapedValue().
*/
public function testGetUnescapedValue() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testToString().
*/
public function testToString() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testEscapeValue().
*/
public function testEscapeValue() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testIsValid().
*/
public function testIsValid() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testGetErrorMessage().
*/
public function testGetErrorMessage() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testEnsureDefaultValue().
*/
public function testEnsureDefaultValue() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testCheckFilter().
*/
public function testCheckFilter() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testCheckMaxLength().
*/
public function testCheckMaxLength() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* @todo Implement testCheckMinLength().
*/
public function testCheckMinLength() {
// Remove the following lines when you implement this test.
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
}
/**
* Checks that argument is valid after a notnull check when value is not null
*/
public function testCheckNotNullWhenNotNull() {
$member_srl_argument = new ConditionArgument('member_srl', 20, 'equal');
$member_srl_argument->checkNotNull();
$this->assertEquals(true, $member_srl_argument->isValid());
}
/**
* Checks that argument becomes invalid after a notnull check when value is null
*/
public function testCheckNotNullWhenNull() {
$member_srl_argument = new ConditionArgument('member_srl', null, 'equal');
$member_srl_argument->checkNotNull();
$this->assertEquals(false, $member_srl_argument->isValid());
}
/**
* Checks that argument value stays the same when both user value and default value are given
*/
public function testCheckDefaultValueWhenNotNull() {
$member_srl_argument = new ConditionArgument('member_srl', 20, 'equal');
$member_srl_argument->ensureDefaultValue(25);
$this->assertEquals(20, $member_srl_argument->getValue());
}
/**
* Checks that argument value gets set when user value is null and default value is specified
*/
public function testCheckDefaultValueWhenNull() {
$member_srl_argument = new ConditionArgument('member_srl', null, 'equal');
$member_srl_argument->ensureDefaultValue(25);
$this->assertEquals(25, $member_srl_argument->getValue());
}
/**
* Checks like prefix operation
*/
public function testCreateConditionValue_LikePrefix() {
$member_srl_argument = new ConditionArgument('"mid"', 'forum', 'like_prefix');
$member_srl_argument->createConditionValue();
$this->assertEquals('forum%', $member_srl_argument->getValue());
}
/**
* Checks like tail operation
*/
public function testCreateConditionValue_LikeTail() {
$member_srl_argument = new ConditionArgument('"mid"', 'forum', 'like_tail');
$member_srl_argument->createConditionValue();
$this->assertEquals('%forum', $member_srl_argument->getValue());
}
/**
* Checks like operation
*/
public function testCreateConditionValue_Like() {
$member_srl_argument = new ConditionArgument('"mid"', 'forum', 'like');
$member_srl_argument->createConditionValue();
$this->assertEquals('%forum%', $member_srl_argument->getValue());
}
/**
* Checks in operation
*/
public function testCreateConditionValue_In_StringValues() {
$member_srl_argument = new ConditionArgument('"mid"', array('forum', 'board'), 'in');
$member_srl_argument->createConditionValue();
$this->assertEquals('(\'forum\',\'board\')', $member_srl_argument->getValue());
}
/**
* Checks in operation
*/
public function testCreateConditionValue_In_NumericValues() {
$member_srl_argument = new ConditionArgument('"module_srl"', array(3, 21), 'in');
$member_srl_argument->setColumnType('number');
$member_srl_argument->createConditionValue();
$this->assertEquals('(3,21)', $member_srl_argument->getValue());
}
}
?>