mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
API CHANGE Removed assertType() and assertEmpty() workarounds. Use assertInstanceOf()
instead of assertType(), assertEmpty() is available in PHPUnit 3.5+. PHPUnit 3.4 is no longer supported, so please upgrade your version to work. MINOR Removed FullTestSuite which was a workaround for PHPUnit but not used.
This commit is contained in:
parent
8b607db0a2
commit
b1e17578c7
@ -16,7 +16,7 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
|
||||
CMSMenu::add_controller('CMSMenuTest_LeftAndMainController');
|
||||
$menuItems = CMSMenu::get_menu_items();
|
||||
$menuItem = $menuItems['CMSMenuTest_LeftAndMainController'];
|
||||
$this->assertType('CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem');
|
||||
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'Controller menu item is of class CMSMenuItem');
|
||||
$this->assertEquals($menuItem->url, singleton('CMSMenuTest_LeftAndMainController')->Link(), 'Controller menu item has the correct link');
|
||||
$this->assertEquals($menuItem->controller, 'CMSMenuTest_LeftAndMainController', 'Controller menu item has the correct controller class');
|
||||
$this->assertEquals($menuItem->priority, singleton('CMSMenuTest_LeftAndMainController')->stat('menu_priority'), 'Controller menu item has the correct priority');
|
||||
@ -26,7 +26,7 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
|
||||
CMSMenu::add_link('LinkCode', 'link title', 'http://www.example.com');
|
||||
$menuItems = CMSMenu::get_menu_items();
|
||||
$menuItem = $menuItems['LinkCode'];
|
||||
$this->assertType('CMSMenuItem', $menuItem, 'Link menu item is of class CMSMenuItem');
|
||||
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'Link menu item is of class CMSMenuItem');
|
||||
$this->assertEquals($menuItem->title, 'link title', 'Link menu item has the correct title');
|
||||
$this->assertEquals($menuItem->url,'http://www.example.com', 'Link menu item has the correct link');
|
||||
$this->assertNull($menuItem->controller, 'Link menu item has no controller class');
|
||||
@ -53,7 +53,7 @@ class CMSMenuTest extends SapphireTest implements TestOnly {
|
||||
CMSMenu::clear_menu();
|
||||
CMSMenu::populate_menu();
|
||||
$menuItem = CMSMenu::get_menu_item('SecurityAdmin');
|
||||
$this->assertType('CMSMenuItem', $menuItem, 'SecurityAdmin menu item exists');
|
||||
$this->assertInstanceOf('CMSMenuItem', $menuItem, 'SecurityAdmin menu item exists');
|
||||
$this->assertEquals($menuItem->url, singleton('SecurityAdmin')->Link(), 'Menu item has the correct link');
|
||||
$this->assertEquals($menuItem->controller, 'SecurityAdmin', 'Menu item has the correct controller class');
|
||||
$this->assertEquals(
|
||||
|
@ -98,7 +98,7 @@ class LeftAndMainTest extends FunctionalTest {
|
||||
|
||||
$response = $this->get($link);
|
||||
|
||||
$this->assertType('SS_HTTPResponse', $response, "$link should return a response object");
|
||||
$this->assertInstanceOf('SS_HTTPResponse', $response, "$link should return a response object");
|
||||
$this->assertEquals(200, $response->getStatusCode(), "$link should return 200 status code");
|
||||
// Check that a HTML page has been returned
|
||||
$this->assertRegExp('/<html[^>]*>/i', $response->getBody(), "$link should contain <html> tag");
|
||||
|
@ -652,61 +652,6 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Backported from PHPUnit 3.4 in order to maintain backwards
|
||||
* compatibility: assertType() is deprecated in PHPUnit 3.5 (with PHP 5.2.7+),
|
||||
* but as SilverStripe 2.3 and 2.4 support PHP 5.1 we can't require it.
|
||||
*/
|
||||
public static function assertType($expected, $actual, $message = '') {
|
||||
// PHPUnit_Util_DeprecatedFeature_Logger::log(
|
||||
// 'assertType() will be removed in PHPUnit 3.6 and should no longer ' .
|
||||
// 'be used. assertInternalType() should be used for asserting ' .
|
||||
// 'internal types such as "integer" or "string" whereas ' .
|
||||
// 'assertInstanceOf() should be used for asserting that an object is ' .
|
||||
// 'an instance of a specified class or interface.'
|
||||
// );
|
||||
|
||||
if (is_string($expected)) {
|
||||
if (PHPUnit_Util_Type::isType($expected)) {
|
||||
$constraint = new PHPUnit_Framework_Constraint_IsType(
|
||||
$expected
|
||||
);
|
||||
}
|
||||
|
||||
else if (class_exists($expected) || interface_exists($expected)) {
|
||||
$constraint = new PHPUnit_Framework_Constraint_IsInstanceOf(
|
||||
$expected
|
||||
);
|
||||
}
|
||||
|
||||
else {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(
|
||||
1, 'class or interface name'
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
|
||||
}
|
||||
|
||||
self::assertThat($actual, $constraint, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide assertEmpty() in PHPUnit <3.5.
|
||||
* We want to support PHPUnit 3.4, as this is the most recent release available
|
||||
* to environments running PHP <=5.2.6, such as Debian Lenny.
|
||||
*/
|
||||
public static function assertEmpty($item, $message = '') {
|
||||
if(class_exists('PHPUnit_Framework_Constraint_IsEmpty')) {
|
||||
parent::assertEmpty($item, $message);
|
||||
} else {
|
||||
if(!empty($item)) {
|
||||
$message = $message ? $message : "Failed asserting that " . var_export($item, true) . " is empty.";
|
||||
throw new PHPUnit_Framework_AssertionFailedError($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for the DOS matchers
|
||||
*/
|
||||
|
@ -1,83 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Alternative to letting PHPUnit handle class retrieval via
|
||||
* traversing the filesystem. Works around restrictions of PHPUnit
|
||||
* on running tests on multiple directories at once, without resorting
|
||||
* to group or testsuite definitions in a custom phpunit.xml file.
|
||||
*
|
||||
* Usage:
|
||||
* - "phpunit framework/tests/FullTestSuite.php"
|
||||
* (all tests)
|
||||
* - "phpunit framework/tests/FullTestSuite.php '' module=framework,cms"
|
||||
* (comma-separated modules. empty quotes are necessary to avoid PHPUnit argument confusion)
|
||||
*
|
||||
* See http://www.phpunit.de/manual/current/en/organizing-tests.html#organizing-tests.testsuite
|
||||
*
|
||||
* Note: We can't unit test this class because of segfaults in PHP5.3 when trying to
|
||||
* use get_all_tests() within a SapphireTest.
|
||||
*
|
||||
* @package framework
|
||||
* @subpackage testing
|
||||
*/
|
||||
class FullTestSuite {
|
||||
|
||||
/**
|
||||
* Called by the PHPUnit runner to gather runnable tests.
|
||||
*
|
||||
* @return PHPUnit_Framework_TestSuite
|
||||
*/
|
||||
public static function suite() {
|
||||
require_once(dirname(__FILE__) . '/bootstrap.php');
|
||||
|
||||
$suite = new PHPUnit_Framework_TestSuite();
|
||||
if(isset($_GET['module'])) {
|
||||
$classList = self::get_module_tests($_GET['module']);
|
||||
} else {
|
||||
$classList = self::get_all_tests();
|
||||
}
|
||||
|
||||
foreach($classList as $className) {
|
||||
$suite->addTest(new SapphireTestSuite($className));
|
||||
}
|
||||
|
||||
return $suite;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Array
|
||||
*/
|
||||
public static function get_all_tests() {
|
||||
require_once(dirname(__FILE__) . '/bootstrap.php');
|
||||
|
||||
TestRunner::use_test_manifest();
|
||||
$tests = ClassInfo::subclassesFor('SapphireTest');
|
||||
array_shift($tests);
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run tests for one or more "modules".
|
||||
* A module is generally a toplevel folder, e.g. "mysite" or "framework".
|
||||
*
|
||||
* @param String $nameStr
|
||||
* @return Array
|
||||
*/
|
||||
protected static function get_module_tests($namesStr) {
|
||||
require_once(dirname(__FILE__) . '/bootstrap.php');
|
||||
|
||||
$tests = array();
|
||||
$names = explode(',', $namesStr);
|
||||
foreach($names as $name) {
|
||||
$classesForModule = ClassInfo::classes_for_folder($name);
|
||||
if($classesForModule) foreach($classesForModule as $class) {
|
||||
if(class_exists($class) && is_subclass_of($class, 'SapphireTest')) {
|
||||
$tests[] = $class;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $tests;
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class DirectorTest extends SapphireTest {
|
||||
$url = 'DirectorTestRequest_Controller/' . sprintf($testfunction, ucfirst($method)) . '?' . http_build_query($fixture);
|
||||
$getresponse = Director::test($url, $fixture, null, strtoupper($method), null, null, $fixture);
|
||||
|
||||
$this->assertType('SS_HTTPResponse', $getresponse, 'Director::test() returns SS_HTTPResponse');
|
||||
$this->assertInstanceOf('SS_HTTPResponse', $getresponse, 'Director::test() returns SS_HTTPResponse');
|
||||
$this->assertEquals($fixture['somekey'], $getresponse->getBody(), 'Director::test() ' . $testfunction);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ class RequestHandlingTest extends FunctionalTest {
|
||||
|
||||
function testConstructedWithNullRequest() {
|
||||
$r = new RequestHandler();
|
||||
$this->assertType('NullHTTPRequest', $r->getRequest());
|
||||
$this->assertInstanceOf('NullHTTPRequest', $r->getRequest());
|
||||
}
|
||||
|
||||
function testRequestHandlerChainingAllParams() {
|
||||
|
@ -165,19 +165,19 @@ class ObjectTest extends SapphireTest {
|
||||
$inst = new ObjectTest_ExtensionTest();
|
||||
$extensions = $inst->getExtensionInstances();
|
||||
$this->assertEquals(count($extensions), 2);
|
||||
$this->assertType(
|
||||
$this->assertInstanceOf(
|
||||
'ObjectTest_ExtendTest1',
|
||||
$extensions['ObjectTest_ExtendTest1']
|
||||
);
|
||||
$this->assertType(
|
||||
$this->assertInstanceOf(
|
||||
'ObjectTest_ExtendTest2',
|
||||
$extensions['ObjectTest_ExtendTest2']
|
||||
);
|
||||
$this->assertType(
|
||||
$this->assertInstanceOf(
|
||||
'ObjectTest_ExtendTest1',
|
||||
$inst->getExtensionInstance('ObjectTest_ExtendTest1')
|
||||
);
|
||||
$this->assertType(
|
||||
$this->assertInstanceOf(
|
||||
'ObjectTest_ExtendTest2',
|
||||
$inst->getExtensionInstance('ObjectTest_ExtendTest2')
|
||||
);
|
||||
|
@ -26,7 +26,6 @@ class SS_LogTest extends SapphireTest {
|
||||
SS_Log::add_writer($testFileWriter, SS_Log::WARN);
|
||||
|
||||
$writers = SS_Log::get_writers();
|
||||
$this->assertType('array', $writers);
|
||||
$this->assertEquals(2, count($writers));
|
||||
}
|
||||
|
||||
@ -38,12 +37,11 @@ class SS_LogTest extends SapphireTest {
|
||||
|
||||
SS_Log::remove_writer($testEmailWriter);
|
||||
$writers = SS_Log::get_writers();
|
||||
$this->assertType('array', $writers);
|
||||
|
||||
$this->assertEquals(1, count($writers));
|
||||
|
||||
SS_Log::remove_writer($testFileWriter);
|
||||
$writers = SS_Log::get_writers();
|
||||
$this->assertType('array', $writers);
|
||||
$this->assertEquals(0, count($writers));
|
||||
}
|
||||
|
||||
|
@ -61,10 +61,10 @@ class FileTest extends SapphireTest {
|
||||
$this->assertEquals($testfilePath, $file->Filename, '"Filename" property remains unchanged');
|
||||
|
||||
// TODO This should be auto-detected, see File->updateFilesystem()
|
||||
// $this->assertType('Folder', $file->Parent(), 'Parent folder is created in database');
|
||||
// $this->assertInstanceOf('Folder', $file->Parent(), 'Parent folder is created in database');
|
||||
// $this->assertFileExists($file->Parent()->getFullPath(), 'Parent folder is created on filesystem');
|
||||
// $this->assertEquals('FileTest', $file->Parent()->Name);
|
||||
// $this->assertType('Folder', $file->Parent()->Parent(), 'Grandparent folder is created in database');
|
||||
// $this->assertInstanceOf('Folder', $file->Parent()->Parent(), 'Grandparent folder is created in database');
|
||||
// $this->assertFileExists($file->Parent()->Parent()->getFullPath(), 'Grandparent folder is created on filesystem');
|
||||
// $this->assertEquals('assets', $file->Parent()->Parent()->Name);
|
||||
}
|
||||
|
@ -241,12 +241,12 @@ class FormTest extends FunctionalTest {
|
||||
SecurityToken::enable();
|
||||
|
||||
$form1 = $this->getStubForm();
|
||||
$this->assertType('SecurityToken', $form1->getSecurityToken());
|
||||
$this->assertInstanceOf('SecurityToken', $form1->getSecurityToken());
|
||||
|
||||
SecurityToken::disable();
|
||||
|
||||
$form2 = $this->getStubForm();
|
||||
$this->assertType('NullSecurityToken', $form2->getSecurityToken());
|
||||
$this->assertInstanceOf('NullSecurityToken', $form2->getSecurityToken());
|
||||
|
||||
SecurityToken::enable();
|
||||
}
|
||||
@ -255,7 +255,7 @@ class FormTest extends FunctionalTest {
|
||||
SecurityToken::enable();
|
||||
|
||||
$formWithToken = $this->getStubForm();
|
||||
$this->assertType(
|
||||
$this->assertInstanceOf(
|
||||
'HiddenField',
|
||||
$formWithToken->Fields()->fieldByName(SecurityToken::get_default_name()),
|
||||
'Token field added by default'
|
||||
|
@ -8,7 +8,7 @@ class GridFieldConfigTest extends SapphireTest {
|
||||
|
||||
function testGetComponents() {
|
||||
$config = GridFieldConfig::create();
|
||||
$this->assertType('ArrayList', $config->getComponents());
|
||||
$this->assertInstanceOf('ArrayList', $config->getComponents());
|
||||
$this->assertEquals($config->getComponents()->Count(), 0);
|
||||
|
||||
$config
|
||||
|
@ -441,8 +441,8 @@ class i18nTest extends SapphireTest {
|
||||
i18n::register_translator($translator, 'custom', 10);
|
||||
$translators = i18n::get_translators();
|
||||
$this->assertArrayHasKey('custom', $translators[10]);
|
||||
$this->assertType('Zend_Translate', $translators[10]['custom']);
|
||||
$this->assertType('i18nTest_CustomTranslatorAdapter', $translators[10]['custom']->getAdapter());
|
||||
$this->assertInstanceOf('Zend_Translate', $translators[10]['custom']);
|
||||
$this->assertInstanceOf('i18nTest_CustomTranslatorAdapter', $translators[10]['custom']->getAdapter());
|
||||
|
||||
i18n::unregister_translator('custom');
|
||||
$translators = i18n::get_translators();
|
||||
|
@ -41,10 +41,10 @@ class DataExtensionTest extends SapphireTest {
|
||||
$object = DataObject::get_one('DataExtensionTest_RelatedObject', "\"ContactID\" = {$contactID}");
|
||||
|
||||
$this->assertNotNull($object, 'Related object not null');
|
||||
$this->assertType('DataExtensionTest_Member', $object->Contact(), 'Related contact is a member dataobject');
|
||||
$this->assertType('DataExtensionTest_Member', $object->getComponent('Contact'), 'getComponent does the same thing as Contact()');
|
||||
$this->assertInstanceOf('DataExtensionTest_Member', $object->Contact(), 'Related contact is a member dataobject');
|
||||
$this->assertInstanceOf('DataExtensionTest_Member', $object->getComponent('Contact'), 'getComponent does the same thing as Contact()');
|
||||
|
||||
$this->assertType('DataExtensionTest_RelatedObject', $contact->RelatedObjects()->First());
|
||||
$this->assertInstanceOf('DataExtensionTest_RelatedObject', $contact->RelatedObjects()->First());
|
||||
$this->assertEquals("Lorem ipsum dolor", $contact->RelatedObjects()->First()->FieldOne);
|
||||
$this->assertEquals("Random notes", $contact->RelatedObjects()->First()->FieldTwo);
|
||||
$contact->delete();
|
||||
@ -143,7 +143,7 @@ class DataExtensionTest extends SapphireTest {
|
||||
function testDbObjectOnExtendedFields() {
|
||||
$member = $this->objFromFixture('DataExtensionTest_Member', 'member1');
|
||||
$this->assertNotNull($member->dbObject('Website'));
|
||||
$this->assertType('Varchar', $member->dbObject('Website'));
|
||||
$this->assertInstanceOf('Varchar', $member->dbObject('Website'));
|
||||
}
|
||||
|
||||
function testExtensionCanBeAppliedToDataObject() {
|
||||
|
@ -161,7 +161,7 @@ class DataListTest extends SapphireTest {
|
||||
$team = DataList::create("DataObjectTest_Team")->byID($id);
|
||||
|
||||
// byID() returns a DataObject, rather than a DataList
|
||||
$this->assertType('DataObjectTest_Team', $team);
|
||||
$this->assertInstanceOf('DataObjectTest_Team', $team);
|
||||
$this->assertEquals('Team 2', $team->Title);
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ class DataObjectLazyLoadingTest extends SapphireTest {
|
||||
$subteam1Lazy = $teams->find('ID', $subteam1->ID);
|
||||
|
||||
$parentTeamLazy = $subteam1Lazy->ParentTeam();
|
||||
$this->assertType('DataObjectTest_Team', $parentTeamLazy);
|
||||
$this->assertInstanceOf('DataObjectTest_Team', $parentTeamLazy);
|
||||
$this->assertEquals($parentTeam->ID, $parentTeamLazy->ID);
|
||||
}
|
||||
|
||||
|
@ -719,7 +719,7 @@ class DataObjectTest extends SapphireTest {
|
||||
$changedFields = $changedDO->getChangedFields();
|
||||
|
||||
// Don't write the record, it will reset changed fields
|
||||
$this->assertType('DataObjectTest_SubTeam', $changedDO);
|
||||
$this->assertInstanceOf('DataObjectTest_SubTeam', $changedDO);
|
||||
$this->assertEquals($changedDO->ClassName, 'DataObjectTest_SubTeam');
|
||||
$this->assertContains('ClassName', array_keys($changedFields));
|
||||
$this->assertEquals($changedFields['ClassName']['before'], 'DataObjectTest_Team');
|
||||
@ -727,7 +727,7 @@ class DataObjectTest extends SapphireTest {
|
||||
|
||||
$changedDO->write();
|
||||
|
||||
$this->assertType('DataObjectTest_SubTeam', $changedDO);
|
||||
$this->assertInstanceOf('DataObjectTest_SubTeam', $changedDO);
|
||||
$this->assertEquals($changedDO->ClassName, 'DataObjectTest_SubTeam');
|
||||
}
|
||||
|
||||
|
@ -21,14 +21,14 @@ class MoneyTest extends SapphireTest {
|
||||
|
||||
function testMoneyFieldsReturnedAsObjects() {
|
||||
$obj = $this->objFromFixture('MoneyTest_DataObject', 'test1');
|
||||
$this->assertType('Money', $obj->MyMoney);
|
||||
$this->assertInstanceOf('Money', $obj->MyMoney);
|
||||
}
|
||||
|
||||
|
||||
function testLoadFromFixture() {
|
||||
$obj = $this->objFromFixture('MoneyTest_DataObject', 'test1');
|
||||
|
||||
$this->assertType('Money', $obj->MyMoney);
|
||||
$this->assertInstanceOf('Money', $obj->MyMoney);
|
||||
$this->assertEquals($obj->MyMoney->getCurrency(), 'EUR');
|
||||
$this->assertEquals($obj->MyMoney->getAmount(), 1.23);
|
||||
}
|
||||
@ -42,7 +42,7 @@ class MoneyTest extends SapphireTest {
|
||||
$this->assertNotContains('MyMoney', array_keys($changed));
|
||||
|
||||
// With changes
|
||||
$this->assertType('Money', $obj->MyMoney);
|
||||
$this->assertInstanceOf('Money', $obj->MyMoney);
|
||||
$obj->MyMoney->setAmount(99);
|
||||
$changed = $obj->getChangedFields();
|
||||
$this->assertContains('MyMoney', array_keys($changed), 'Field is detected as changed');
|
||||
@ -229,7 +229,7 @@ class MoneyTest extends SapphireTest {
|
||||
function testLoadIntoDataObject() {
|
||||
$obj = new MoneyTest_DataObject();
|
||||
|
||||
$this->assertType('Money', $obj->obj('MyMoney'));
|
||||
$this->assertInstanceOf('Money', $obj->obj('MyMoney'));
|
||||
|
||||
$m = new Money();
|
||||
$m->setValue(array(
|
||||
|
@ -94,11 +94,11 @@ class VersionedTest extends SapphireTest {
|
||||
function testVersionedFieldsAdded() {
|
||||
$obj = new VersionedTest_DataObject();
|
||||
// Check that the Version column is added as a full-fledged column
|
||||
$this->assertType('Int', $obj->dbObject('Version'));
|
||||
$this->assertInstanceOf('Int', $obj->dbObject('Version'));
|
||||
|
||||
$obj2 = new VersionedTest_Subclass();
|
||||
// Check that the Version column is added as a full-fledged column
|
||||
$this->assertType('Int', $obj2->dbObject('Version'));
|
||||
$this->assertInstanceOf('Int', $obj2->dbObject('Version'));
|
||||
}
|
||||
|
||||
function testPublishCreateNewVersion() {
|
||||
|
@ -108,7 +108,7 @@ class SearchContextTest extends SapphireTest {
|
||||
|
||||
$project = $results->First();
|
||||
|
||||
$this->assertType('SearchContextTest_Project', $project);
|
||||
$this->assertInstanceOf('SearchContextTest_Project', $project);
|
||||
$this->assertEquals("Blog Website", $project->Name);
|
||||
$this->assertEquals(2, $project->Actions()->Count());
|
||||
|
||||
|
@ -150,7 +150,7 @@ class MemberTest extends FunctionalTest {
|
||||
$this->assertTrue($passwords->current()->checkPassword('test1'), "Password test1 not found in MemberRecord");
|
||||
|
||||
$passwords->next();
|
||||
$this->assertType('DataObject', $passwords->current());
|
||||
$this->assertInstanceOf('DataObject', $passwords->current());
|
||||
$this->assertTrue($passwords->current()->checkPassword('1nitialPassword'), "Password 1nitialPassword not found in MemberRecord");
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ class PasswordEncryptorTest extends SapphireTest {
|
||||
function testCreateForCode() {
|
||||
Config::inst()->update('PasswordEncryptor', 'encryptors', array('test'=>array('PasswordEncryptorTest_TestEncryptor'=>null)));
|
||||
$e = PasswordEncryptor::create_for_algorithm('test');
|
||||
$this->assertType('PasswordEncryptorTest_TestEncryptor', $e );
|
||||
$this->assertInstanceOf('PasswordEncryptorTest_TestEncryptor', $e );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,7 @@ class SecurityDefaultAdminTest extends SapphireTest {
|
||||
|
||||
$admin = Security::findAnAdministrator();
|
||||
|
||||
$this->assertType('Member', $admin);
|
||||
$this->assertInstanceOf('Member', $admin);
|
||||
$this->assertTrue(Permission::checkMember($admin, 'ADMIN'));
|
||||
$this->assertNull($admin->Email);
|
||||
$this->assertNull($admin->Password);
|
||||
|
@ -41,7 +41,7 @@ class SecurityTokenTest extends SapphireTest {
|
||||
|
||||
function testInst() {
|
||||
$inst1 = SecurityToken::inst();
|
||||
$this->assertType('SecurityToken', $inst1);
|
||||
$this->assertInstanceOf('SecurityToken', $inst1);
|
||||
}
|
||||
|
||||
function testInstReturnsSingleton() {
|
||||
@ -111,7 +111,7 @@ class SecurityTokenTest extends SapphireTest {
|
||||
$t->updateFieldSet($fs);
|
||||
$f = $fs->dataFieldByName($t->getName());
|
||||
|
||||
$this->assertType('HiddenField', $f);
|
||||
$this->assertInstanceOf('HiddenField', $f);
|
||||
$this->assertEquals($f->getName(), $t->getName(), 'Name matches');
|
||||
$this->assertEquals($f->Value(), $t->getValue(), 'Value matches');
|
||||
}
|
||||
@ -123,7 +123,7 @@ class SecurityTokenTest extends SapphireTest {
|
||||
$t->updateFieldSet($fs); // second
|
||||
$f = $fs->dataFieldByName($t->getName());
|
||||
|
||||
$this->assertType('HiddenField', $f);
|
||||
$this->assertInstanceOf('HiddenField', $f);
|
||||
$this->assertEquals(1, $fs->Count());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user