Skip to content

Commit

Permalink
#1251 Use class references instead of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
j3nsch committed Oct 30, 2024
1 parent d01ed2a commit 7688a75
Show file tree
Hide file tree
Showing 24 changed files with 64 additions and 64 deletions.
8 changes: 4 additions & 4 deletions tests/library/Application/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function testSetLogger()
$this->config->setLogger($logger);

$this->assertNotNull($this->config->getLogger());
$this->assertInstanceOf('MockLogger', $this->config->getLogger());
$this->assertInstanceOf(MockLogger::class, $this->config->getLogger());
}

public function testGetSupportedLanguages()
Expand Down Expand Up @@ -212,7 +212,7 @@ public function testGetInstance()
{
$config = Application_Configuration::getInstance();
$this->assertNotNull($config);
$this->assertInstanceOf('Application_Configuration', $config);
$this->assertInstanceOf(Application_Configuration::class, $config);
$this->assertSame($config, Application_Configuration::getInstance());
}

Expand All @@ -232,12 +232,12 @@ public function testGetName()
public function testClearInstance()
{
$config = Application_Configuration::getInstance();
$this->assertInstanceOf('Application_Configuration', $config);
$this->assertInstanceOf(Application_Configuration::class, $config);

Application_Configuration::clearInstance();

$config2 = Application_Configuration::getInstance();
$this->assertInstanceOf('Application_Configuration', $config2);
$this->assertInstanceOf(Application_Configuration::class, $config2);

$this->assertNotSame($config, $config2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private function getPage($label)
public function testAvailable()
{
$this->assertNotNull($this->helper);
$this->assertInstanceOf('Application_Controller_Action_Helper_Breadcrumbs', $this->helper);
$this->assertInstanceOf(Application_Controller_Action_Helper_Breadcrumbs::class, $this->helper);
}

public function testDirect()
Expand Down
10 changes: 5 additions & 5 deletions tests/library/Application/Controller/ActionCRUDTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,15 @@ public function testGetModelForm()
$form = $this->controller->getModelForm();

$this->assertNotNull($form);
$this->assertInstanceOf('Admin_Form_Licence', $form);
$this->assertInstanceOf(Admin_Form_Licence::class, $form);
}

public function testGetNewModelForm()
{
$form = $this->controller->getNewModelForm();

$this->assertNotNull($form);
$this->assertInstanceOf('Admin_Form_Licence', $form);
$this->assertInstanceOf(Admin_Form_Licence::class, $form);
$this->assertNull($form->getElement(Application_Form_Model_Abstract::ELEMENT_MODEL_ID)->getValue());
}

Expand All @@ -211,7 +211,7 @@ public function testGetEditModelForm()
$form = $this->controller->getEditModelForm($model);

$this->assertNotNull($form);
$this->assertInstanceOf('Admin_Form_Licence', $form);
$this->assertInstanceOf(Admin_Form_Licence::class, $form);
$this->assertEquals(2, $form->getElement(Application_Form_Model_Abstract::ELEMENT_MODEL_ID)->getValue());
}

Expand Down Expand Up @@ -244,15 +244,15 @@ public function testGetConfirmationForm()
$model = Licence::get(2);
$form = $this->controller->getConfirmationForm($model);
$this->assertNotNull($form);
$this->assertInstanceOf('Application_Form_Confirmation', $form);
$this->assertInstanceOf(Application_Form_Confirmation::class, $form);
$this->assertEquals(2, $form->getModelId());
}

public function testGetConfirmationFormNull()
{
$form = $this->controller->getConfirmationForm(null);
$this->assertNotNull($form);
$this->assertInstanceOf('Application_Form_Confirmation', $form);
$this->assertInstanceOf(Application_Form_Confirmation::class, $form);
}

public function testHandlePostCancel()
Expand Down
6 changes: 3 additions & 3 deletions tests/library/Application/Export/ExportServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testGetPlugin()
$plugin = $this->service->getPlugin('index');

$this->assertNotNull($plugin);
$this->assertInstanceOf('Export_Model_XmlExport', $plugin);
$this->assertInstanceOf(Export_Model_XmlExport::class, $plugin);

$pluginConfig = $plugin->getConfig();

Expand Down Expand Up @@ -111,7 +111,7 @@ public function testSetDefaults()
public function testAddPlugin()
{
$this->service->addPlugin('marc', new Zend_Config([
'class' => 'Export_Model_XsltExport',
'class' => Export_Model_XsltExport::class,
'stylesheet' => 'marc.xslt',
]));

Expand All @@ -122,7 +122,7 @@ public function testAddPlugin()
$plugin = $this->service->getPlugin('marc');

$this->assertNotNull($plugin);
$this->assertInstanceOf('Export_Model_XsltExport', $plugin);
$this->assertInstanceOf(Export_Model_XsltExport::class, $plugin);

$config = $plugin->getConfig();

Expand Down
4 changes: 2 additions & 2 deletions tests/library/Application/Export/ExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public function testAddFormats()

$bibtex = $formats['bibtex'];

$this->assertInstanceOf('Zend_Navigation_Page_Mvc', $bibtex);
$this->assertInstanceOf(Zend_Navigation_Page_Mvc::class, $bibtex);
$this->assertEquals('/citationExport/index/download/output/bibtex', $bibtex->getHref());

$bibtex->setParam('docId', 146);
Expand Down Expand Up @@ -137,7 +137,7 @@ public function testContextProperties()
// Zend_Navigation_Page_Mvc
$bibtex = $formats['bibtex'];

$this->assertInstanceOf('Zend_Navigation_Page_Mvc', $bibtex);
$this->assertInstanceOf(Zend_Navigation_Page_Mvc::class, $bibtex);

$this->assertTrue($bibtex->get('frontdoor'));
$this->assertFalse($bibtex->get('search'));
Expand Down
2 changes: 1 addition & 1 deletion tests/library/Application/Model/AbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testSetLogger()
$this->model->setLogger($logger);

$this->assertNotNull($this->model->getLogger());
$this->assertInstanceOf('MockLogger', $this->model->getLogger());
$this->assertInstanceOf(MockLogger::class, $this->model->getLogger());
}

public function testGetConfig()
Expand Down
8 changes: 4 additions & 4 deletions tests/library/Application/Search/FacetManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function testGetFacetLanguage()

$facet = $manager->getFacet('language');

$this->assertInstanceOf('Application_Search_Facet_Language', $facet);
$this->assertInstanceOf(Application_Search_Facet_Language::class, $facet);
$this->assertFalse($facet->isTranslated());
$this->assertEquals('Deutsch', $facet->getLabel('deu'));
}
Expand All @@ -80,7 +80,7 @@ public function testGetFacetDocType()
$facet = $manager->getFacet('doctype');

$this->assertNotNull($facet);
$this->assertInstanceOf('Application_Search_Facet', $facet);
$this->assertInstanceOf(Application_Search_Facet::class, $facet);
$this->assertTrue($facet->isTranslated());
}

Expand All @@ -105,7 +105,7 @@ public function testGetFacetEnrichment()
$facet = $manager->getFacet('enrichment_Audience');

$this->assertNotNull($facet);
$this->assertInstanceOf('Application_Search_Facet', $facet);
$this->assertInstanceOf(Application_Search_Facet::class, $facet);
$this->assertFalse($facet->isTranslated());
}

Expand All @@ -120,7 +120,7 @@ public function testGetFacetEnrichmentTranslated()
$facet = $manager->getFacet('enrichment_Audience');

$this->assertNotNull($facet);
$this->assertInstanceOf('Application_Search_Facet', $facet);
$this->assertInstanceOf(Application_Search_Facet::class, $facet);
$this->assertFalse($facet->isTranslated());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ public function testGetExportTmxFile()
$tmxFile = $manager->getExportTmxFile();

$this->assertNotNull($tmxFile);
$this->assertInstanceOf('Application_Translate_TmxFile', $tmxFile);
$this->assertInstanceOf(Application_Translate_TmxFile::class, $tmxFile);

$dom = $tmxFile->getDomDocument();

Expand Down Expand Up @@ -432,7 +432,7 @@ public function testGetExportTmxFileWithDefaultModuleTranslations()
$tmxFile = $manager->getExportTmxFile();

$this->assertNotNull($tmxFile);
$this->assertInstanceOf('Application_Translate_TmxFile', $tmxFile);
$this->assertInstanceOf(Application_Translate_TmxFile::class, $tmxFile);

$dom = $tmxFile->getDomDocument();
$output = $dom->saveXML();
Expand Down Expand Up @@ -465,7 +465,7 @@ public function testGetExportTmxFileFiltered()
$tmxFile = $manager->getExportTmxFile();

$this->assertNotNull($tmxFile);
$this->assertInstanceOf('Application_Translate_TmxFile', $tmxFile);
$this->assertInstanceOf(Application_Translate_TmxFile::class, $tmxFile);

$dom = $tmxFile->getDomDocument();
$output = $dom->saveXML();
Expand Down Expand Up @@ -493,7 +493,7 @@ public function testGetExportTmxFileIncludingUnmodified()
$tmxFile = $manager->getExportTmxFile(true);

$this->assertNotNull($tmxFile);
$this->assertInstanceOf('Application_Translate_TmxFile', $tmxFile);
$this->assertInstanceOf(Application_Translate_TmxFile::class, $tmxFile);

$dom = $tmxFile->getDomDocument();
$output = $dom->saveXML();
Expand Down
4 changes: 2 additions & 2 deletions tests/library/Application/TranslateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testSetLogger()
$this->translate->setLogger($logger);

$this->assertNotNull($this->translate->getLogger());
$this->assertInstanceOf('MockLogger', $this->translate->getLogger());
$this->assertInstanceOf(MockLogger::class, $this->translate->getLogger());
}

public function testLoadLanguageDirectory()
Expand Down Expand Up @@ -400,7 +400,7 @@ public function testFallbackToDefaultLanguage()

$translate = Application_Translate::getInstance();

$this->assertInstanceOf('Application_Translate', $translate);
$this->assertInstanceOf(Application_Translate::class, $translate);

$key = 'test_fallback';

Expand Down
4 changes: 2 additions & 2 deletions tests/library/Application/XsltTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testGetInstance()
$xslt = Application_Xslt::getInstance();

$this->assertNotNull($xslt);
$this->assertInstanceOf('Application_Xslt', $xslt);
$this->assertInstanceOf(Application_Xslt::class, $xslt);

$this->assertSame($xslt, Application_Xslt::getInstance());
}
Expand All @@ -63,7 +63,7 @@ public function testFindHelper()
$helper = $xslt->findHelper('translate');

$this->assertNotNull($helper);
$this->assertInstanceOf('Application_View_Helper_Translate', $helper);
$this->assertInstanceOf(Application_View_Helper_Translate::class, $helper);
}

public function testCallStatic()
Expand Down
6 changes: 3 additions & 3 deletions tests/modules/admin/forms/AbstractDocumentSubFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ public function testProcessPost()
],
];

$subform1 = $this->getMockForAbstractClass('Application_Form_Model_Abstract');
$subform1 = $this->getMockForAbstractClass(Application_Form_Model_Abstract::class);
$subform1->expects($this->exactly(1))->method('processPost')->will($this->returnValue(null));

$subform2 = $this->getMockForAbstractClass('Application_Form_Model_Abstract');
$subform2 = $this->getMockForAbstractClass(Application_Form_Model_Abstract::class);
$subform2->expects($this->exactly(0))->method('processPost')->will($this->returnValue(null));

$subform2->processPost($post, $post);
Expand All @@ -134,6 +134,6 @@ public function testGetDatesHelper()
$form = $this->getForm();

$this->assertNotNull($form->getDatesHelper());
$this->assertInstanceOf('Application_Controller_Action_Helper_Dates', $form->getDatesHelper());
$this->assertInstanceOf(Application_Controller_Action_Helper_Dates::class, $form->getDatesHelper());
}
}
4 changes: 2 additions & 2 deletions tests/modules/admin/forms/AbstractModelSubFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class Admin_Form_AbstractModelSubFormTest extends ControllerTestCase
{
public function testConstructForm()
{
$form = $this->getMockForAbstractClass('Admin_Form_AbstractModelSubForm');
$form = $this->getMockForAbstractClass(Admin_Form_AbstractModelSubForm::class);

$this->assertInstanceOf('Zend_Form', $form);
$this->assertInstanceOf(Zend_Form::class, $form);

$this->assertEquals(0, count($form->getElements()));
$this->assertEquals(0, count($form->getSubForms()));
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/admin/forms/Document/CollectionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function testPopulateFromPost()

$ddcform = $subforms['ddc2'];

$this->assertInstanceOf('Admin_Form_Document_Section', $ddcform);
$this->assertInstanceOf(Admin_Form_Document_Section::class, $ddcform);

$colforms = $ddcform->getSubforms();

Expand Down
6 changes: 3 additions & 3 deletions tests/modules/admin/forms/Document/FilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ public function testPopulateFromModel()
$this->assertEquals(3, count($form->getSubForms()));

$this->assertNotNull($form->getSubForm('File0'));
$this->assertInstanceOf('Admin_Form_Document_File', $form->getSubForm('File0'));
$this->assertInstanceOf(Admin_Form_Document_File::class, $form->getSubForm('File0'));
$this->assertNotNull($form->getSubForm('File0')->getModel());

$this->assertNotNull($form->getSubForm('File1'));
$this->assertInstanceOf('Admin_Form_Document_File', $form->getSubForm('File1'));
$this->assertInstanceOf(Admin_Form_Document_File::class, $form->getSubForm('File1'));
$this->assertNotNull($form->getSubForm('File1')->getModel());
}

public function testColumnLabelTranslations()
{
$form = new Admin_Form_Document_Files();

$property = new ReflectionProperty('Admin_Form_Document_Files', 'header');
$property = new ReflectionProperty(Admin_Form_Document_Files::class, 'header');
$property->setAccessible(true);

$header = $property->getValue($form);
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/admin/forms/Document/SubjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testCreateFormWithLanguage()

$language = $form->getElement('Language');
$this->assertNotNull($language);
$this->assertInstanceOf('Zend_Form_Element_Hidden', $language);
$this->assertInstanceOf(Zend_Form_Element_Hidden::class, $language);
$this->assertEquals('deu', $language->getValue());

$this->assertEquals('swd', $form->getSubjectType());
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/admin/forms/Document/SubjectTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testCreateNewSubFormInstance()

$subform = $form->createNewSubFormInstance();

$this->assertInstanceOf('Admin_Form_Document_Subject', $subform);
$this->assertInstanceOf(Admin_Form_Document_Subject::class, $subform);
$this->assertEquals('psyndex', $subform->getSubjectType());
$this->assertNull($subform->getLanguage());
}
Expand All @@ -71,7 +71,7 @@ public function testCreateNewSubFormInstanceSwd()

$subform = $form->createNewSubFormInstance();

$this->assertInstanceOf('Admin_Form_Document_Subject', $subform);
$this->assertInstanceOf(Admin_Form_Document_Subject::class, $subform);
$this->assertEquals('swd', $subform->getSubjectType());
$this->assertEquals('deu', $subform->getLanguage());
}
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/admin/forms/DocumentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function testGetInstanceFromPost()
$form = Admin_Form_Document::getInstanceFromPost($post, $document);

$this->assertNotNull($form);
$this->assertInstanceOf('Admin_Form_Document', $form);
$this->assertInstanceOf(Admin_Form_Document::class, $form);
}

public function testProcessPostEmpty()
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/admin/forms/FileManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function testConstructFromPost()

$form->constructFromPost($post, $document);

$this->assertInstanceOf('Admin_Form_FileManager', $form);
$this->assertInstanceOf(Admin_Form_FileManager::class, $form);
$this->assertEquals(2, count($form->getSubForm('Files')->getSubForms()));

$fileForm = $form->getSubForm('Files')->getSubForm('File0');
Expand Down Expand Up @@ -219,7 +219,7 @@ public function testGetInstanceFromPost()

$form = Admin_Form_FileManager::getInstanceFromPost($post, $document);

$this->assertInstanceOf('Admin_Form_FileManager', $form);
$this->assertInstanceOf(Admin_Form_FileManager::class, $form);
$this->assertEquals(1, count($form->getSubForm('Files')->getSubForms()));

$fileForm = $form->getSubForm('Files')->getSubForm('File0');
Expand Down
4 changes: 2 additions & 2 deletions tests/modules/admin/models/DocumentEditSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function testGetSessionNamespace()

$this->assertNotNull($namespace);

$this->assertInstanceOf('Zend_Session_Namespace', $namespace);
$this->assertInstanceOf(Zend_Session_Namespace::class, $namespace);

// zweimal aufrufen; beim ersten Mal ist die interne Variable noch nicht gesetzt
$namespace2 = $model->getSessionNamespace();
Expand All @@ -146,7 +146,7 @@ public function testGetDocumentSessionNamespace()
$namespace = $model->getDocumentSessionNamespace();

$this->assertNotNull($namespace);
$this->assertInstanceOf('Zend_Session_Namespace', $namespace);
$this->assertInstanceOf(Zend_Session_Namespace::class, $namespace);

$namespace2 = $model->getDocumentSessionNamespace();

Expand Down
2 changes: 1 addition & 1 deletion tests/modules/admin/models/OptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function testGetOptions()
$this->assertCount(2, $options);

foreach ($options as $name => $option) {
$this->assertInstanceOf('Admin_Model_Option', $option);
$this->assertInstanceOf(Admin_Model_Option::class, $option);
$this->assertEquals($name, $option->getName());
}
}
Expand Down
Loading

0 comments on commit 7688a75

Please sign in to comment.