forked from LiveCarta/PayPal-PHP-SDK
Validation Package Testing
- Added More Unit Tests to Validation Classes - Updated Logic accordingly
This commit is contained in:
51
tests/PayPal/Test/Validation/ArgumentValidatorTest.php
Normal file
51
tests/PayPal/Test/Validation/ArgumentValidatorTest.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
namespace PayPal\Test\Validation;
|
||||
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
|
||||
class ArgumentValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public static function positiveProvider()
|
||||
{
|
||||
return array(
|
||||
array("1"),
|
||||
array("something here"),
|
||||
array(1),
|
||||
array(array(1,2,3)),
|
||||
array(0.123),
|
||||
array(true),
|
||||
array(false),
|
||||
array(array()),
|
||||
);
|
||||
}
|
||||
|
||||
public static function invalidProvider()
|
||||
{
|
||||
return array(
|
||||
array(null),
|
||||
array(''),
|
||||
array(' ')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @dataProvider positiveProvider
|
||||
*/
|
||||
public function testValidate($input)
|
||||
{
|
||||
$this->assertTrue(ArgumentValidator::validate($input, "Name"));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @dataProvider invalidProvider
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function testInvalidDataValidate($input)
|
||||
{
|
||||
$this->assertTrue(ArgumentValidator::validate($input, "Name"));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user