Open Journal Systems
3.3.0
ValidatorTypeDescriptionTest.php
1
<?php
2
17
import
(
'lib.pkp.tests.PKPTestCase'
);
18
import
(
'lib.pkp.classes.validation.ValidatorTypeDescription'
);
19
20
class
ValidatorTypeDescriptionTest
extends
PKPTestCase
{
25
public
function
testInstantiateAndCheck
() {
26
$typeDescription =
new
ValidatorTypeDescription
(
'email'
);
27
self::assertTrue($typeDescription->isCompatible($object =
'jerico.dev@gmail.com'
));
28
self::assertFalse($typeDescription->isCompatible($object =
'another string'
));
29
}
30
35
function
testInstantiateWithInvalidTypeDescriptor1
() {
36
// An unknown type name will cause an error.
37
$this->expectError();
38
$typeDescription =
new
ValidatorTypeDescription
(
'email(xyz]'
);
39
}
40
45
function
testInstantiateWithInvalidTypeDescriptor2
() {
46
// We don't allow multi-dimensional arrays.
47
$this->expectError();
48
$typeDescription =
new
ValidatorTypeDescription
(
'Email'
);
49
}
50
55
function
testInstantiateWithInvalidTypeDescriptor3
() {
56
// An invalid cardinality will also cause an error.
57
$this->expectError();
58
$typeDescription =
new
ValidatorTypeDescription
(
'email&'
);
59
}
60
}
61
ValidatorTypeDescriptionTest
Test class for ValidatorTypeDescription and TypeDescription.
Definition:
ValidatorTypeDescriptionTest.php:20
ValidatorTypeDescriptionTest\testInstantiateAndCheck
testInstantiateAndCheck()
Definition:
ValidatorTypeDescriptionTest.php:25
ValidatorTypeDescriptionTest\testInstantiateWithInvalidTypeDescriptor1
testInstantiateWithInvalidTypeDescriptor1()
Definition:
ValidatorTypeDescriptionTest.php:35
PKPTestCase
Class that implements functionality common to all PKP unit test cases.
Definition:
PKPTestCase.inc.php:27
ValidatorTypeDescriptionTest\testInstantiateWithInvalidTypeDescriptor3
testInstantiateWithInvalidTypeDescriptor3()
Definition:
ValidatorTypeDescriptionTest.php:55
ValidatorTypeDescription
Class that describes a string input/output type that passes additional validation (via standard valid...
Definition:
ValidatorTypeDescription.inc.php:19
ValidatorTypeDescriptionTest\testInstantiateWithInvalidTypeDescriptor2
testInstantiateWithInvalidTypeDescriptor2()
Definition:
ValidatorTypeDescriptionTest.php:45
lib
pkp
tests
classes
validation
ValidatorTypeDescriptionTest.php
Generated on Fri Aug 28 2020 14:53:54 for Open Journal Systems by
1.8.17