Open Journal Systems
3.3.0
ClassTypeDescriptionTest.php
1
<?php
2
17
import
(
'lib.pkp.tests.PKPTestCase'
);
18
import
(
'lib.pkp.classes.filter.ClassTypeDescription'
);
19
import
(
'lib.pkp.tests.classes.filter.TestClass1'
);
20
import
(
'lib.pkp.tests.classes.filter.TestClass2'
);
21
22
class
ClassTypeDescriptionTest
extends
PKPTestCase
{
26
public
function
testInstantiateAndCheck
() {
27
$typeDescription =
new
ClassTypeDescription
(
'lib.pkp.tests.classes.filter.TestClass1'
);
28
$compatibleObject =
new
TestClass1
();
29
$wrongObject =
new
TestClass2
();
30
self::assertTrue($typeDescription->isCompatible($compatibleObject));
31
self::assertFalse($typeDescription->isCompatible($wrongObject));
32
}
33
37
function
testInstantiateWithInvalidTypeDescriptor1
() {
38
// An unknown type name will cause an error.
39
$this->expectError();
40
$typeDescription =
new
ClassTypeDescription
(
'ClassWithoutPackage'
);
41
}
42
}
43
TestClass2
Test class to be used/instantiated by ClassTypeDescriptionTest.
Definition:
TestClass2.inc.php:16
ClassTypeDescription
A type description that validates objects by class type.
Definition:
ClassTypeDescription.inc.php:20
ClassTypeDescriptionTest\testInstantiateAndCheck
testInstantiateAndCheck()
Definition:
ClassTypeDescriptionTest.php:26
PKPTestCase
Class that implements functionality common to all PKP unit test cases.
Definition:
PKPTestCase.inc.php:27
TestClass1
Test class to be used/instantiated by ClassTypeDescriptionTest.
Definition:
TestClass1.inc.php:16
ClassTypeDescriptionTest
Test class for ClassTypeDescription.
Definition:
ClassTypeDescriptionTest.php:22
ClassTypeDescriptionTest\testInstantiateWithInvalidTypeDescriptor1
testInstantiateWithInvalidTypeDescriptor1()
Definition:
ClassTypeDescriptionTest.php:37
lib
pkp
tests
classes
filter
ClassTypeDescriptionTest.php
Generated on Fri Aug 28 2020 14:51:05 for Open Journal Systems by
1.8.17