diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..edfd3405 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,30 @@ +language: php +php: + - 5.3 + - 5.4 + +env: + - TESTDB=MYSQL + - TESTDB=PGSQL + +matrix: + exclude: + - php: 5.4 + env: TESTDB=PGSQL + +before_script: + - ./tests/travis/before_script ~/builds/ss + - cd ~/builds/ss + +script: + - php framework/cli-script.php dev/tests/module/cms + +branches: + except: + - translation-staging + - 2.4 + +notifications: + irc: + channels: + - "irc.freenode.org#silverstripe" diff --git a/code/batchactions/CMSBatchActions.php b/code/batchactions/CMSBatchActions.php index 7d080b2b..0354eddd 100644 --- a/code/batchactions/CMSBatchActions.php +++ b/code/batchactions/CMSBatchActions.php @@ -6,17 +6,17 @@ * @subpackage batchaction */ class CMSBatchAction_Publish extends CMSBatchAction { - function getActionTitle() { + public function getActionTitle() { return _t('CMSBatchActions.PUBLISH_PAGES', 'Publish'); } - function run(SS_List $pages) { + public function run(SS_List $pages) { return $this->batchaction($pages, 'doPublish', _t('CMSBatchActions.PUBLISHED_PAGES', 'Published %d pages, %d failures') ); } - function applicablePages($ids) { + public function applicablePages($ids) { return $this->applicablePagesHelper($ids, 'canPublish', true, false); } } @@ -28,11 +28,11 @@ class CMSBatchAction_Publish extends CMSBatchAction { * @subpackage batchaction */ class CMSBatchAction_Unpublish extends CMSBatchAction { - function getActionTitle() { + public function getActionTitle() { return _t('CMSBatchActions.UNPUBLISH_PAGES', 'Un-publish'); } - function run(SS_List $pages) { + public function run(SS_List $pages) { return $this->batchaction($pages, 'doUnpublish', _t('CMSBatchActions.UNPUBLISHED_PAGES', 'Un-published %d pages') ); @@ -46,11 +46,11 @@ class CMSBatchAction_Unpublish extends CMSBatchAction { * @subpackage batchaction */ class CMSBatchAction_Delete extends CMSBatchAction { - function getActionTitle() { + public function getActionTitle() { return _t('CMSBatchActions.DELETE_DRAFT_PAGES', 'Delete from draft site'); } - function run(SS_List $pages) { + public function run(SS_List $pages) { $status = array( 'modified'=>array(), 'deleted'=>array(), @@ -81,7 +81,7 @@ class CMSBatchAction_Delete extends CMSBatchAction { return $this->response(_t('CMSBatchActions.DELETED_DRAFT_PAGES', 'Deleted %d pages from draft site, %d failures'), $status); } - function applicablePages($ids) { + public function applicablePages($ids) { return $this->applicablePagesHelper($ids, 'canDelete', true, false); } } @@ -93,12 +93,12 @@ class CMSBatchAction_Delete extends CMSBatchAction { * @subpackage batchaction */ class CMSBatchAction_DeleteFromLive extends CMSBatchAction { - function getActionTitle() { + public function getActionTitle() { return _t('CMSBatchActions.DELETE_PAGES', 'Delete from published site'); } - function run(SS_List $pages) { + public function run(SS_List $pages) { $status = array( 'modified'=>array(), 'deleted'=>array() @@ -126,7 +126,7 @@ class CMSBatchAction_DeleteFromLive extends CMSBatchAction { return $this->response(_t('CMSBatchActions.DELETED_PAGES', 'Deleted %d pages from published site, %d failures'), $status); } - function applicablePages($ids) { + public function applicablePages($ids) { return $this->applicablePagesHelper($ids, 'canDelete', false, true); } } diff --git a/code/controllers/AssetAdmin.php b/code/controllers/AssetAdmin.php index 0fd1beab..62facb37 100644 --- a/code/controllers/AssetAdmin.php +++ b/code/controllers/AssetAdmin.php @@ -484,7 +484,7 @@ JS } } - function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) { + public function getSiteTreeFor($className, $rootID = null, $childrenMethod = null, $numChildrenMethod = null, $filterFunction = null, $minNodeCount = 30) { if (!$childrenMethod) $childrenMethod = 'ChildFolders'; return parent::getSiteTreeFor($className, $rootID, $childrenMethod, $numChildrenMethod, $filterFunction, $minNodeCount); } @@ -638,7 +638,7 @@ JS return $items; } - function providePermissions() { + public function providePermissions() { $title = _t("AssetAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class)); return array( "CMS_ACCESS_AssetAdmin" => array( diff --git a/code/controllers/CMSMain.php b/code/controllers/CMSMain.php index eeae05b9..ccafe2fc 100644 --- a/code/controllers/CMSMain.php +++ b/code/controllers/CMSMain.php @@ -81,7 +81,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr CMSBatchActionHandler::register('deletefromlive', 'CMSBatchAction_DeleteFromLive'); } - function index($request) { + public function index($request) { // In case we're not showing a specific record, explicitly remove any session state, // to avoid it being highlighted in the tree, and causing an edit form to show. if(!$request->param('Action')) $this->setCurrentPageId(null); @@ -104,7 +104,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr * * @return boolean */ - function ShowSwitchView() { + public function ShowSwitchView() { return true; } @@ -112,7 +112,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr * Overloads the LeftAndMain::ShowView. Allows to pass a page as a parameter, so we are able * to switch view also for archived versions. */ - function SwitchView($page = null) { + public function SwitchView($page = null) { if(!$page) { $page = $this->currentPage(); } @@ -202,7 +202,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $link; } - function LinkPageAdd($extraArguments = null) { + public function LinkPageAdd($extraArguments = null) { $link = singleton("CMSPageAddController")->Link(); $this->extend('updateLinkPageAdd', $link); if($extraArguments) $link = Controller::join_links ($link, $extraArguments); @@ -245,7 +245,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $html; } - function SearchForm() { + public function SearchForm() { // get all page types in a dropdown-compatible format $pageTypeClasses = SiteTree::page_type_classes(); $pageTypes = array(); @@ -313,7 +313,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $form; } - function doSearch($data, $form) { + public function doSearch($data, $form) { return $this->getsubtree($this->request); } @@ -993,13 +993,13 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $this->getResponseNegotiator()->respond($this->request); } - function publish($data, $form) { + public function publish($data, $form) { $data['publish'] = '1'; return $this->save($data, $form); } - function unpublish($data, $form) { + public function unpublish($data, $form) { $className = $this->stat('tree_class'); $record = DataObject::get_by_id($className, $data['ID']); @@ -1019,7 +1019,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr /** * @return array */ - function rollback() { + public function rollback() { return $this->doRollback(array( 'ID' => $this->currentPageID(), 'Version' => $this->request->param('VersionID') @@ -1034,7 +1034,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr * * @return html */ - function doRollback($data, $form) { + public function doRollback($data, $form) { $this->extend('onBeforeRollback', $data['ID']); $id = (isset($data['ID'])) ? (int) $data['ID'] : null; @@ -1074,11 +1074,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr /** * Batch Actions Handler */ - function batchactions() { + public function batchactions() { return new CMSBatchActionHandler($this, 'batchactions'); } - function BatchActionParameters() { + public function BatchActionParameters() { $batchActions = CMSBatchActionHandler::$batch_actions; $forms = array(); @@ -1101,11 +1101,11 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr /** * Returns a list of batch actions */ - function BatchActionList() { + public function BatchActionList() { return $this->batchactions()->batchActionList(); } - function buildbrokenlinks($request) { + public function buildbrokenlinks($request) { // Protect against CSRF on destructive action if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400); @@ -1141,7 +1141,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr } } - function publishall($request) { + public function publishall($request) { if(!Permission::check('ADMIN')) return Security::permissionFailure($this); increase_time_limit_to(); @@ -1198,7 +1198,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr /** * Restore a completely deleted page from the SiteTree_versions table. */ - function restore($data, $form) { + public function restore($data, $form) { if(!isset($data['ID']) || !is_numeric($data['ID'])) { return new SS_HTTPResponse("Please pass an ID in the form content", 400); } @@ -1221,7 +1221,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr return $this->getResponseNegotiator()->respond($this->request); } - function duplicate($request) { + public function duplicate($request) { // Protect against CSRF on destructive action if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400); @@ -1247,7 +1247,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr } } - function duplicatewithchildren($request) { + public function duplicatewithchildren($request) { // Protect against CSRF on destructive action if(!SecurityToken::inst()->checkRequest($request)) return $this->httpError(400); @@ -1288,7 +1288,7 @@ class CMSMain extends LeftAndMain implements CurrentPageIdentifier, PermissionPr ); } - function providePermissions() { + public function providePermissions() { $title = _t("CMSPagesController.MENUTITLE", LeftAndMain::menu_title_for_class('CMSPagesController')); return array( "CMS_ACCESS_CMSMain" => array( diff --git a/code/controllers/CMSPageAddController.php b/code/controllers/CMSPageAddController.php index a16f6609..0f7743c9 100644 --- a/code/controllers/CMSPageAddController.php +++ b/code/controllers/CMSPageAddController.php @@ -15,7 +15,7 @@ class CMSPageAddController extends CMSPageEditController { /** * @return Form */ - function AddForm() { + public function AddForm() { $record = $this->currentPage(); $pageTypes = array(); diff --git a/code/controllers/CMSPageHistoryController.php b/code/controllers/CMSPageHistoryController.php index 43251753..846df975 100644 --- a/code/controllers/CMSPageHistoryController.php +++ b/code/controllers/CMSPageHistoryController.php @@ -39,7 +39,7 @@ class CMSPageHistoryController extends CMSMain { /** * @return array */ - function show($request) { + public function show($request) { $form = $this->ShowVersionForm($request->param('VersionID')); $negotiator = $this->getResponseNegotiator(); @@ -57,7 +57,7 @@ class CMSPageHistoryController extends CMSMain { /** * @return array */ - function compare($request) { + public function compare($request) { $form = $this->CompareVersionsForm( $request->param('VersionID'), $request->param('OtherVersionID') @@ -88,7 +88,7 @@ class CMSPageHistoryController extends CMSMain { * * @return Form */ - function getEditForm($id = null, $fields = null, $versionID = null, $compareID = null) { + public function getEditForm($id = null, $fields = null, $versionID = null, $compareID = null) { if(!$id) $id = $this->currentPageID(); $record = $this->getRecord($id, $versionID); @@ -178,7 +178,7 @@ class CMSPageHistoryController extends CMSMain { * * @return Form */ - function VersionsForm() { + public function VersionsForm() { $id = $this->currentPageID(); $page = $this->getRecord($id); $versionsHtml = ''; @@ -269,7 +269,7 @@ class CMSPageHistoryController extends CMSMain { * * @return html */ - function doCompare($data, $form) { + public function doCompare($data, $form) { $versions = $data['Versions']; if(count($versions) < 2) return null; @@ -306,7 +306,7 @@ class CMSPageHistoryController extends CMSMain { * * @return html */ - function doShowVersion($data, $form) { + public function doShowVersion($data, $form) { $versionID = null; if(isset($data['Versions']) && is_array($data['Versions'])) { @@ -334,7 +334,7 @@ class CMSPageHistoryController extends CMSMain { /** * @return Form */ - function ShowVersionForm($versionID = null) { + public function ShowVersionForm($versionID = null) { if(!$versionID) return null; $id = $this->currentPageID(); @@ -346,7 +346,7 @@ class CMSPageHistoryController extends CMSMain { /** * @return Form */ - function CompareVersionsForm($versionID, $otherVersionID) { + public function CompareVersionsForm($versionID, $otherVersionID) { if($versionID > $otherVersionID) { $toVersion = $versionID; $fromVersion = $otherVersionID; diff --git a/code/controllers/CMSPageSettingsController.php b/code/controllers/CMSPageSettingsController.php index 592cad29..02f9da3a 100644 --- a/code/controllers/CMSPageSettingsController.php +++ b/code/controllers/CMSPageSettingsController.php @@ -11,7 +11,7 @@ class CMSPageSettingsController extends CMSMain { static $required_permission_codes = 'CMS_ACCESS_CMSMain'; static $session_namespace = 'CMSMain'; - function getEditForm($id = null, $fields = null) { + public function getEditForm($id = null, $fields = null) { $record = $this->getRecord($id ? $id : $this->currentPageID()); return parent::getEditForm($record, ($record) ? $record->getSettingsFields() : null); diff --git a/code/controllers/CMSPagesController.php b/code/controllers/CMSPagesController.php index 56aa2687..1df20395 100644 --- a/code/controllers/CMSPagesController.php +++ b/code/controllers/CMSPagesController.php @@ -12,7 +12,7 @@ class CMSPagesController extends CMSMain { static $required_permission_codes = 'CMS_ACCESS_CMSMain'; static $session_namespace = 'CMSMain'; - function LinkPreview() { + public function LinkPreview() { return false; } diff --git a/code/controllers/CMSSettingsController.php b/code/controllers/CMSSettingsController.php index e0815272..cb8d0e23 100644 --- a/code/controllers/CMSSettingsController.php +++ b/code/controllers/CMSSettingsController.php @@ -19,7 +19,7 @@ class CMSSettingsController extends LeftAndMain { /** * @return Form */ - function getEditForm($id = null, $fields = null) { + public function getEditForm($id = null, $fields = null) { $siteConfig = SiteConfig::current_site_config(); $fields = $siteConfig->getCMSFields(); @@ -51,7 +51,7 @@ class CMSSettingsController extends LeftAndMain { * @param Form $form * @return String */ - function save_siteconfig($data, $form) { + public function save_siteconfig($data, $form) { $siteConfig = SiteConfig::current_site_config(); $form->saveInto($siteConfig); $siteConfig->write(); @@ -60,11 +60,11 @@ class CMSSettingsController extends LeftAndMain { return $this->getResponseNegotiator()->respond($this->request); } - function LinkPreview() { + public function LinkPreview() { return false; } - function Breadcrumbs($unlinked = false) { + public function Breadcrumbs($unlinked = false) { $defaultTitle = self::menu_title_for_class(get_class($this)); return new ArrayList(array( new ArrayData(array( diff --git a/code/controllers/CMSSiteTreeFilter.php b/code/controllers/CMSSiteTreeFilter.php index 25067baa..eeab5657 100644 --- a/code/controllers/CMSSiteTreeFilter.php +++ b/code/controllers/CMSSiteTreeFilter.php @@ -36,7 +36,7 @@ abstract class CMSSiteTreeFilter extends Object { */ protected $childrenMethod = null; - function __construct($params = null) { + public function __construct($params = null) { if($params) $this->params = $params; parent::__construct(); @@ -46,14 +46,14 @@ abstract class CMSSiteTreeFilter extends Object { * @return String Method on {@link Hierarchy} objects * which is used to traverse into children relationships. */ - function getChildrenMethod() { + public function getChildrenMethod() { return $this->childrenMethod; } /** * @return Array Map of Page IDs to their respective ParentID values. */ - function pagesIncluded() {} + public function pagesIncluded() {} /** * Populate the IDs of the pages returned by pagesIncluded(), also including @@ -116,11 +116,11 @@ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter { protected $childrenMethod = "AllHistoricalChildren"; - static function title() { + static public function title() { return _t('CMSSiteTreeFilter_DeletedPages.Title', "All pages, including deleted"); } - function pagesIncluded() { + public function pagesIncluded() { $ids = array(); // TODO Not very memory efficient, but usually not very many deleted pages exist $pages = Versioned::get_including_deleted('SiteTree'); @@ -139,11 +139,11 @@ class CMSSiteTreeFilter_DeletedPages extends CMSSiteTreeFilter { */ class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter { - static function title() { + static public function title() { return _t('CMSSiteTreeFilter_ChangedPages.Title', "Changed pages"); } - function pagesIncluded() { + public function pagesIncluded() { $ids = array(); $q = new SQLQuery(); $q->setSelect(array('"SiteTree"."ID"','"SiteTree"."ParentID"')) @@ -165,7 +165,7 @@ class CMSSiteTreeFilter_ChangedPages extends CMSSiteTreeFilter { */ class CMSSiteTreeFilter_Search extends CMSSiteTreeFilter { - static function title() { + static public function title() { return _t('CMSSiteTreeFilter_Search.Title', "All pages"); } diff --git a/code/controllers/ContentController.php b/code/controllers/ContentController.php index a098365d..5f67e6b7 100644 --- a/code/controllers/ContentController.php +++ b/code/controllers/ContentController.php @@ -217,7 +217,7 @@ class ContentController extends Controller { * * @return string */ - function project() { + public function project() { global $project; return $project; } @@ -333,7 +333,7 @@ HTML; } } - function SiteConfig() { + public function SiteConfig() { if(method_exists($this->dataRecord, 'getSiteConfig')) { return $this->dataRecord->getSiteConfig(); } else { @@ -347,7 +347,7 @@ HTML; * @deprecated 2.5 Use ContentLocale() instead and write attribute names suitable to XHTML/HTML * templates directly in the template. */ - function LangAttributes() { + public function LangAttributes() { Deprecation::notice('2.5', 'Use ContentLocale() instead and write attribute names suitable to XHTML/HTML instead.'); $locale = $this->ContentLocale(); return "xml:lang=\"$locale\" lang=\"$locale\""; @@ -364,7 +364,7 @@ HTML; * * @return string */ - function ContentLocale() { + public function ContentLocale() { if($this->dataRecord && $this->dataRecord->hasExtension('Translatable')) { $locale = $this->dataRecord->Locale; } elseif(class_exists('Translatable') && Object::has_extension('SiteTree', 'Translatable')) { @@ -379,7 +379,7 @@ HTML; /** * This action is called by the installation system */ - function successfullyinstalled() { + public function successfullyinstalled() { // The manifest should be built by now, so it's safe to publish the 404 page $fourohfour = Versioned::get_one_by_stage('ErrorPage', 'Stage', '"ErrorCode" = 404'); if($fourohfour) { @@ -406,7 +406,7 @@ HTML; ); } - function deleteinstallfiles() { + public function deleteinstallfiles() { if(!Permission::check("ADMIN")) return Security::permissionFailure($this); $title = new Varchar("Title"); diff --git a/code/controllers/ModelAsController.php b/code/controllers/ModelAsController.php index c57bf45e..e6d0178b 100644 --- a/code/controllers/ModelAsController.php +++ b/code/controllers/ModelAsController.php @@ -16,7 +16,7 @@ class ModelAsController extends Controller implements NestedController { * @param string $action * @return ContentController */ - public static function controller_for(SiteTree $sitetree, $action = null) { + static public function controller_for(SiteTree $sitetree, $action = null) { if($sitetree->class == 'SiteTree') $controller = "ContentController"; else $controller = "{$sitetree->class}_Controller"; @@ -148,7 +148,7 @@ class ModelAsController extends Controller implements NestedController { * @param int $parentID The ID of the parent of the page the URLSegment belongs to. * @return SiteTree */ - static function find_old_page($URLSegment,$parentID = 0, $ignoreNestedURLs = false) { + static public function find_old_page($URLSegment,$parentID = 0, $ignoreNestedURLs = false) { $URLSegment = Convert::raw2sql(rawurlencode($URLSegment)); $useParentIDFilter = SiteTree::nested_urls() && $parentID; diff --git a/code/controllers/ReportAdmin.php b/code/controllers/ReportAdmin.php index 0eeb6439..21067b78 100644 --- a/code/controllers/ReportAdmin.php +++ b/code/controllers/ReportAdmin.php @@ -63,7 +63,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider { * @param Member $member * @return boolean */ - function canView($member = null) { + public function canView($member = null) { if(!$member && $member !== FALSE) $member = Member::currentUser(); if(!parent::canView($member)) return false; @@ -101,7 +101,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider { * * @return boolean */ - public static function has_reports() { + static public function has_reports() { return sizeof(SS_Report::get_reports()) > 0; } @@ -137,7 +137,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider { return $link; } - function providePermissions() { + public function providePermissions() { $title = _t("ReportAdmin.MENUTITLE", LeftAndMain::menu_title_for_class($this->class)); return array( "CMS_ACCESS_ReportAdmin" => array( diff --git a/code/controllers/RootURLController.php b/code/controllers/RootURLController.php index 23007ad6..fada980d 100644 --- a/code/controllers/RootURLController.php +++ b/code/controllers/RootURLController.php @@ -26,7 +26,7 @@ class RootURLController extends Controller { * * @return string */ - public static function get_homepage_link() { + static public function get_homepage_link() { if(!self::$cached_homepage_link) { // TODO Move to 'homepagefordomain' module if(class_exists('HomepageForDomainExtension')) { @@ -63,7 +63,7 @@ class RootURLController extends Controller { * * @param string $urlsegment the URL segment for your home page */ - public static function set_default_homepage_link($urlsegment = "home") { + static public function set_default_homepage_link($urlsegment = "home") { self::$default_homepage_link = $urlsegment; } @@ -72,7 +72,7 @@ class RootURLController extends Controller { * * @return string */ - public static function get_default_homepage_link() { + static public function get_default_homepage_link() { return self::$default_homepage_link; } @@ -83,7 +83,7 @@ class RootURLController extends Controller { * @param SiteTree $page * @return bool */ - public static function should_be_on_root(SiteTree $page) { + static public function should_be_on_root(SiteTree $page) { if(!self::$is_at_root && self::get_homepage_link() == trim($page->RelativeLink(true), '/')) { return !( class_exists('Translatable') && $page->hasExtension('Translatable') && $page->Locale && $page->Locale != Translatable::default_locale() @@ -96,7 +96,7 @@ class RootURLController extends Controller { /** * Resets the cached homepage link value - useful for testing. */ - public static function reset() { + static public function reset() { self::$cached_homepage_link = null; } diff --git a/code/controllers/SilverStripeNavigator.php b/code/controllers/SilverStripeNavigator.php index d202ac6d..1bb23de8 100644 --- a/code/controllers/SilverStripeNavigator.php +++ b/code/controllers/SilverStripeNavigator.php @@ -22,7 +22,7 @@ class SilverStripeNavigator extends ViewableData { /** * @param DataObject */ - function __construct($record) { + public function __construct($record) { if(!in_array('CMSPreviewable', class_implements($record))) { throw new InvalidArgumentException('SilverStripeNavigator: Record of type %s doesn\'t implement CMSPreviewable', get_class($record)); } @@ -33,7 +33,7 @@ class SilverStripeNavigator extends ViewableData { /** * @return SS_List of SilverStripeNavigatorItem */ - function getItems() { + public function getItems() { $items = array(); $classes = ClassInfo::subclassesFor('SilverStripeNavigatorItem'); @@ -65,7 +65,7 @@ class SilverStripeNavigator extends ViewableData { /** * @return DataObject */ - function getRecord() { + public function getRecord() { return $this->record; } @@ -73,7 +73,7 @@ class SilverStripeNavigator extends ViewableData { * @param DataObject $record * @return Array template data */ - static function get_for_record($record) { + static public function get_for_record($record) { $html = ''; $message = ''; $navigator = new SilverStripeNavigator($record); @@ -110,7 +110,7 @@ class SilverStripeNavigatorItem extends ViewableData { /** * @param DataObject */ - function __construct($record) { + public function __construct($record) { $this->record = $record; } @@ -118,13 +118,13 @@ class SilverStripeNavigatorItem extends ViewableData { * @return String HTML, mostly a link - but can be more complex as well. * For example, a "future state" item might show a date selector. */ - function getHTML() {} + public function getHTML() {} /** * @return String * Text displayed in watermark */ - function getWatermark() {} + public function getWatermark() {} /** * Optional link to a specific view of this record. @@ -133,24 +133,24 @@ class SilverStripeNavigatorItem extends ViewableData { * * @return String */ - function getLink() {} + public function getLink() {} /** * @return String */ - function getMessage() {} + public function getMessage() {} /** * @return DataObject */ - function getRecord() { + public function getRecord() { return $this->record; } /** * @return Int */ - function getPriority() { + public function getPriority() { return $this->stat('priority'); } @@ -160,7 +160,7 @@ class SilverStripeNavigatorItem extends ViewableData { * * @return boolean */ - function isActive() { + public function isActive() { return false; } @@ -171,7 +171,7 @@ class SilverStripeNavigatorItem extends ViewableData { * @param Member * @return Boolean */ - function canView($member = null) { + public function canView($member = null) { return true; } } @@ -183,7 +183,7 @@ class SilverStripeNavigatorItem extends ViewableData { class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem { static $priority = 10; - function getHTML() { + public function getHTML() { return sprintf( '%s', $this->record->CMSEditLink(), @@ -191,15 +191,15 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem { ); } - function getLink() { + public function getLink() { return $this->record->CMSEditLink(); } - function isActive() { + public function isActive() { return (Controller::curr() instanceof CMSMain); } - function canView($member = null) { + public function canView($member = null) { // Don't show in CMS return !(Controller::curr() instanceof CMSMain); } @@ -213,7 +213,7 @@ class SilverStripeNavigatorItem_CMSLink extends SilverStripeNavigatorItem { class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem { static $priority = 20; - function getHTML() { + public function getHTML() { $draftPage = $this->getDraftPage(); if($draftPage) { $this->recordLink = Controller::join_links($draftPage->AbsoluteLink(), "?stage=Stage"); @@ -221,23 +221,23 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem { } } - function getWatermark() { + public function getWatermark() { return _t('ContentController.DRAFTSITE'); } - function getMessage() { + public function getMessage() { return "
"; } - function getLink() { + public function getLink() { return Controller::join_links($this->record->AbsoluteLink(), '?stage=Stage'); } - function canView($member = null) { + public function canView($member = null) { return ($this->record->hasExtension('Versioned') && $this->getDraftPage()); } - function isActive() { + public function isActive() { return ( Versioned::current_stage() == 'Stage' && !(ClassInfo::exists('SiteTreeFutureState') && SiteTreeFutureState::get_future_datetime()) @@ -261,7 +261,7 @@ class SilverStripeNavigatorItem_StageLink extends SilverStripeNavigatorItem { class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem { static $priority = 30; - function getHTML() { + public function getHTML() { $livePage = $this->getLivePage(); if($livePage) { $this->recordLink = Controller::join_links($livePage->AbsoluteLink(), "?stage=Live"); @@ -269,23 +269,23 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem { } } - function getWatermark() { + public function getWatermark() { return _t('ContentController.PUBLISHEDSITE'); } - function getMessage() { + public function getMessage() { return " "; } - function getLink() { + public function getLink() { return Controller::join_links($this->record->AbsoluteLink(), '?stage=Live'); } - function canView($member = null) { + public function canView($member = null) { return ($this->record->hasExtension('Versioned') && $this->getLivePage()); } - function isActive() { + public function isActive() { return (!Versioned::current_stage() || Versioned::current_stage() == 'Live'); } @@ -306,12 +306,12 @@ class SilverStripeNavigatorItem_LiveLink extends SilverStripeNavigatorItem { class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem { static $priority = 40; - function getHTML() { + public function getHTML() { $this->recordLink = $this->record->AbsoluteLink(); return "recordLink?archiveDate={$this->record->LastEdited}\" target=\"_blank\">". _t('ContentController.ARCHIVEDSITE', 'Preview version') .""; } - function getMessage() { + public function getMessage() { if($date = Versioned::current_archived_date()) { $dateObj = Datetime::create(); $dateObj->setValue($date); @@ -319,15 +319,15 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem { } } - function getLink() { + public function getLink() { return $this->record->AbsoluteLink() . '?archiveDate=' . $this->record->LastEdited; } - function canView($member = null) { + public function canView($member = null) { return ($this->record->hasExtension('Versioned') && $this->isArchived()); } - function isActive() { + public function isActive() { return (Versioned::current_archived_date()); } @@ -336,7 +336,7 @@ class SilverStripeNavigatorItem_ArchiveLink extends SilverStripeNavigatorItem { * * @return boolean */ - function isArchived() { + public function isArchived() { if(!$this->record->hasExtension('Versioned')) return false; $baseTable = ClassInfo::baseDataClass($this->record->class); diff --git a/code/controllers/StaticExporter.php b/code/controllers/StaticExporter.php index 1dbb8dd6..5462a78a 100644 --- a/code/controllers/StaticExporter.php +++ b/code/controllers/StaticExporter.php @@ -27,7 +27,7 @@ class StaticExporter extends Controller { 'export', ); - function init() { + public function init() { parent::init(); $canAccess = (Director::isDev() || Director::is_cli() || Permission::check("ADMIN")); @@ -35,16 +35,16 @@ class StaticExporter extends Controller { } - function Link($action = null) { + public function Link($action = null) { return "StaticExporter/$action"; } - function index() { + public function index() { echo "')", '"Title"'); } - function columns() { + public function columns() { return array( "Title" => array( "title" => "Title", // todo: use NestedTitle(2) @@ -159,20 +159,20 @@ class SideReport_EmptyPages extends SS_Report { * @subpackage content */ class SideReport_RecentlyEdited extends SS_Report { - function title() { + public function title() { return _t('SideReport.LAST2WEEKS',"Pages edited in the last 2 weeks"); } - function group() { + public function group() { return _t('SideReport.ContentGroupTitle', "Content reports"); } - function sort() { + public function sort() { return 200; } - function sourceRecords($params = null) { + public function sourceRecords($params = null) { $threshold = strtotime('-14 days', SS_Datetime::now()->Format('U')); return DataObject::get("SiteTree", "\"SiteTree\".\"LastEdited\" > '".date("Y-m-d H:i:s", $threshold)."'", "\"SiteTree\".\"LastEdited\" DESC"); } - function columns() { + public function columns() { return array( "Title" => array( "title" => "Title", // todo: use NestedTitle(2) @@ -189,13 +189,13 @@ class SideReport_RecentlyEdited extends SS_Report { * @subpackage content */ class SideReport_BrokenLinks extends SS_Report { - function title() { + public function title() { return _t('SideReport.BROKENLINKS',"Pages with broken links"); } - function group() { + public function group() { return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports"); } - function sourceRecords($params = null) { + public function sourceRecords($params = null) { // Get class names for page types that are not virtual pages or redirector pages $classes = array_diff(ClassInfo::subclassesFor('SiteTree'), ClassInfo::subclassesFor('VirtualPage'), ClassInfo::subclassesFor('RedirectorPage')); $classNames = "'".join("','", $classes)."'"; @@ -204,7 +204,7 @@ class SideReport_BrokenLinks extends SS_Report { else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenLink = 1"); return $ret; } - function columns() { + public function columns() { return array( "Title" => array( "title" => _t('ReportAdmin.ReportTitle', 'Title'), // todo: use NestedTitle(2) @@ -212,7 +212,7 @@ class SideReport_BrokenLinks extends SS_Report { ), ); } - function getParameterFields() { + public function getParameterFields() { return new FieldList( new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site')) ); @@ -227,13 +227,13 @@ class SideReport_BrokenLinks extends SS_Report { * @subpackage content */ class SideReport_BrokenFiles extends SS_Report { - function title() { + public function title() { return _t('SideReport.BROKENFILES',"Pages with broken files"); } - function group() { + public function group() { return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports"); } - function sourceRecords($params = null) { + public function sourceRecords($params = null) { // Get class names for page types that are not virtual pages or redirector pages $classes = array_diff(ClassInfo::subclassesFor('SiteTree'), ClassInfo::subclassesFor('VirtualPage'), ClassInfo::subclassesFor('RedirectorPage')); $classNames = "'".join("','", $classes)."'"; @@ -242,7 +242,7 @@ class SideReport_BrokenFiles extends SS_Report { else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenFile = 1"); return $ret; } - function columns() { + public function columns() { return array( "Title" => array( "title" => "Title", // todo: use NestedTitle(2) @@ -251,7 +251,7 @@ class SideReport_BrokenFiles extends SS_Report { ); } - function getParameterFields() { + public function getParameterFields() { return new FieldList( new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site')) ); @@ -263,20 +263,20 @@ class SideReport_BrokenFiles extends SS_Report { * @subpackage content */ class SideReport_BrokenVirtualPages extends SS_Report { - function title() { + public function title() { return _t('SideReport.BROKENVIRTUALPAGES', 'VirtualPages pointing to deleted pages'); } - function group() { + public function group() { return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports"); } - function sourceRecords($params = null) { + public function sourceRecords($params = null) { $classNames = "'".join("','", ClassInfo::subclassesFor('VirtualPage'))."'"; if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "ClassName IN ($classNames) AND HasBrokenLink = 1"); else $ret = DataObject::get('SiteTree', "ClassName IN ($classNames) AND HasBrokenLink = 1"); return $ret; } - function columns() { + public function columns() { return array( "Title" => array( "title" => "Title", // todo: use NestedTitle(2) @@ -285,7 +285,7 @@ class SideReport_BrokenVirtualPages extends SS_Report { ); } - function getParameterFields() { + public function getParameterFields() { return new FieldList( new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site')) ); @@ -297,13 +297,13 @@ class SideReport_BrokenVirtualPages extends SS_Report { * @subpackage content */ class SideReport_BrokenRedirectorPages extends SS_Report { - function title() { + public function title() { return _t('SideReport.BROKENREDIRECTORPAGES', 'RedirectorPages pointing to deleted pages'); } - function group() { + public function group() { return _t('SideReport.BrokenLinksGroupTitle', "Broken links reports"); } - function sourceRecords($params = null) { + public function sourceRecords($params = null) { $classNames = "'".join("','", ClassInfo::subclassesFor('RedirectorPage'))."'"; if (isset($_REQUEST['OnLive'])) $ret = Versioned::get_by_stage('SiteTree', 'Live', "ClassName IN ($classNames) AND HasBrokenLink = 1"); @@ -311,7 +311,7 @@ class SideReport_BrokenRedirectorPages extends SS_Report { return $ret; } - function columns() { + public function columns() { return array( "Title" => array( "title" => "Title", // todo: use NestedTitle(2) @@ -320,7 +320,7 @@ class SideReport_BrokenRedirectorPages extends SS_Report { ); } - function getParameterFields() { + public function getParameterFields() { return new FieldList( new CheckboxField('OnLive', _t('SideReport.ParameterLiveCheckbox', 'Check live site')) ); diff --git a/code/search/ContentControllerSearchExtension.php b/code/search/ContentControllerSearchExtension.php index 4d63e80d..6f8bf48b 100644 --- a/code/search/ContentControllerSearchExtension.php +++ b/code/search/ContentControllerSearchExtension.php @@ -14,7 +14,7 @@ class ContentControllerSearchExtension extends Extension { /** * Site search form */ - function SearchForm() { + public function SearchForm() { $searchText = _t('SearchForm.SEARCH', 'Search'); if($this->owner->request && $this->owner->request->getVar('Search')) { @@ -39,7 +39,7 @@ class ContentControllerSearchExtension extends Extension { * @param SearchForm $form The form instance that was submitted * @param SS_HTTPRequest $request Request generated for this action */ - function results($data, $form, $request) { + public function results($data, $form, $request) { $data = array( 'Results' => $form->getResults(), 'Query' => $form->getSearchQuery(), diff --git a/code/search/SearchForm.php b/code/search/SearchForm.php index 579ebbc9..f20054c1 100644 --- a/code/search/SearchForm.php +++ b/code/search/SearchForm.php @@ -35,7 +35,7 @@ class SearchForm extends Form { * if fields are added to the form. * @param FieldList $actions Optional, defaults to a single field named "Go". */ - function __construct($controller, $name, $fields = null, $actions = null) { + public function __construct($controller, $name, $fields = null, $actions = null) { if(!$fields) { $fields = new FieldList( new TextField('Search', _t('SearchForm.SEARCH', 'Search') @@ -70,7 +70,7 @@ class SearchForm extends Form { * Set the classes to search. * Currently you can only choose from "SiteTree" and "File", but a future version might improve this. */ - function classesToSearch($classes) { + public function classesToSearch($classes) { $illegalClasses = array_diff($classes, array('SiteTree', 'File')); if($illegalClasses) { user_error("SearchForm::classesToSearch() passed illegal classes '" . implode("', '", $illegalClasses) . "'. At this stage, only File and SiteTree are allowed", E_USER_WARNING); @@ -84,7 +84,7 @@ class SearchForm extends Form { * * @return array */ - function getClassesToSearch() { + public function getClassesToSearch() { return $this->classesToSearch; } diff --git a/code/staticpublisher/FilesystemPublisher.php b/code/staticpublisher/FilesystemPublisher.php index 92a5082d..124ebf70 100644 --- a/code/staticpublisher/FilesystemPublisher.php +++ b/code/staticpublisher/FilesystemPublisher.php @@ -44,7 +44,7 @@ class FilesystemPublisher extends StaticPublisher { * Set a different base URL for the static copy of the site. * This can be useful if you are running the CMS on a different domain from the website. */ - static function set_static_base_url($url) { + static public function set_static_base_url($url) { self::$static_base_url = $url; } @@ -56,7 +56,7 @@ class FilesystemPublisher extends StaticPublisher { * with the filename 'index.html'. If you set the extension to PHP, then a simple PHP script will * be generated that can do appropriate cache & redirect header negotation. */ - function __construct($destFolder = 'cache', $fileExtension = null) { + public function __construct($destFolder = 'cache', $fileExtension = null) { // Remove trailing slash from folder if(substr($destFolder, -1) == '/') $destFolder = substr($destFolder, 0, -1); @@ -90,7 +90,7 @@ class FilesystemPublisher extends StaticPublisher { * @param Array $urls Absolute or relative URLs * @return Array Map of original URLs to filesystem paths (relative to {@link $destFolder}). */ - function urlsToPaths($urls) { + public function urlsToPaths($urls) { $mappedUrls = array(); foreach($urls as $url) { @@ -123,7 +123,7 @@ class FilesystemPublisher extends StaticPublisher { return $mappedUrls; } - function unpublishPages($urls) { + public function unpublishPages($urls) { // Do we need to map these? // Detect a numerically indexed arrays if (is_numeric(join('', array_keys($urls)))) $urls = $this->urlsToPaths($urls); @@ -142,7 +142,7 @@ class FilesystemPublisher extends StaticPublisher { } } - function publishPages($urls) { + public function publishPages($urls) { // Do we need to map these? // Detect a numerically indexed arrays if (is_numeric(join('', array_keys($urls)))) $urls = $this->urlsToPaths($urls); diff --git a/code/staticpublisher/RsyncMultiHostPublisher.php b/code/staticpublisher/RsyncMultiHostPublisher.php index 18383162..957bd03d 100644 --- a/code/staticpublisher/RsyncMultiHostPublisher.php +++ b/code/staticpublisher/RsyncMultiHostPublisher.php @@ -24,7 +24,7 @@ class RsyncMultiHostPublisher extends FilesystemPublisher { * * @param $targets An array of targets to publish to. These can either be local file names, or scp-style targets, in the form "user@server:path" */ - static function set_targets($targets) { + static public function set_targets($targets) { self::$targets = $targets; } @@ -32,11 +32,11 @@ class RsyncMultiHostPublisher extends FilesystemPublisher { * Specify folders to exclude from the rsync * For example, you could exclude assets. */ - static function set_excluded_folders($folders) { + static public function set_excluded_folders($folders) { self::$excluded_folders = $folders; } - function publishPages($urls) { + public function publishPages($urls) { parent::publishPages($urls); $base = Director::baseFolder(); $framework = FRAMEWORK_DIR; diff --git a/code/staticpublisher/StaticPublisher.php b/code/staticpublisher/StaticPublisher.php index 46b49f0d..8f12de90 100644 --- a/code/staticpublisher/StaticPublisher.php +++ b/code/staticpublisher/StaticPublisher.php @@ -24,18 +24,18 @@ abstract class StaticPublisher extends DataExtension { */ static $static_publisher_theme=false; - abstract function publishPages($pages); - abstract function unpublishPages($pages); + abstract public function publishPages($pages); + abstract public function unpublishPages($pages); - static function set_static_publisher_theme($theme){ + static public function set_static_publisher_theme($theme){ self::$static_publisher_theme=$theme; } - static function static_publisher_theme(){ + static public function static_publisher_theme(){ return self::$static_publisher_theme; } - static function echo_progress() { + static public function echo_progress() { return (boolean)self::$echo_progress; } @@ -43,14 +43,14 @@ abstract class StaticPublisher extends DataExtension { * Either turns on (boolean true) or off (boolean false) the progress indicators. * @see StaticPublisher::$echo_progress */ - static function set_echo_progress($progress) { + static public function set_echo_progress($progress) { self::$echo_progress = (boolean)$progress; } /** * Called after a page is published. */ - function onAfterPublish($original) { + public function onAfterPublish($original) { $this->republish($original); } @@ -60,11 +60,11 @@ abstract class StaticPublisher extends DataExtension { * * Only called if the published content exists and has been modified. */ - function onRenameLinkedAsset($original) { + public function onRenameLinkedAsset($original) { $this->republish($original); } - function republish($original) { + public function republish($original) { if (self::$disable_realtime) return; $urls = array(); @@ -102,7 +102,7 @@ abstract class StaticPublisher extends DataExtension { * On after unpublish, get changes and hook into underlying * functionality */ - function onAfterUnpublish($page) { + public function onAfterUnpublish($page) { if (self::$disable_realtime) return; // Get the affected URLs @@ -125,7 +125,7 @@ abstract class StaticPublisher extends DataExtension { /** * Get all external references to CSS, JS, */ - function externalReferencesFor($content) { + public function externalReferencesFor($content) { $CLI_content = escapeshellarg($content); $tidy = `echo $CLI_content | tidy -numeric -asxhtml`; $tidy = preg_replace('/xmlns="[^"]+"/','', $tidy); diff --git a/javascript/SilverStripeNavigator.js b/javascript/SilverStripeNavigator.js index f57a78b0..133a339b 100644 --- a/javascript/SilverStripeNavigator.js +++ b/javascript/SilverStripeNavigator.js @@ -1,4 +1,4 @@ -function windowName(suffix) { +public function windowName(suffix) { var base = document.getElementsByTagName('base')[0].href.replace('http://','').replace(/\//g,'_').replace(/\./g,'_'); return base + suffix; } diff --git a/tasks/FilesystemSyncTask.php b/tasks/FilesystemSyncTask.php index da3e4f70..d5da7f98 100644 --- a/tasks/FilesystemSyncTask.php +++ b/tasks/FilesystemSyncTask.php @@ -12,7 +12,7 @@ class FilesystemSyncTask extends BuildTask { should be called whenever files are added to the assets/ folder from outside SilverStripe, for example, if an author uploads files via FTP."; - function run($request) { + public function run($request) { if(isset($_GET['folderID'])) { $folderID = $_GET['folderID']; } else { diff --git a/tasks/RebuildStaticCacheTask.php b/tasks/RebuildStaticCacheTask.php index c3064340..f9959366 100644 --- a/tasks/RebuildStaticCacheTask.php +++ b/tasks/RebuildStaticCacheTask.php @@ -11,7 +11,7 @@ class RebuildStaticCacheTask extends Controller { 'index', ); - function init() { + public function init() { parent::init(); Versioned::reading_stage('live'); @@ -20,7 +20,7 @@ class RebuildStaticCacheTask extends Controller { if(!$canAccess) return Security::permissionFailure($this); } - function index() { + public function index() { StaticPublisher::set_echo_progress(true); $page = singleton('Page'); @@ -44,7 +44,7 @@ class RebuildStaticCacheTask extends Controller { * @param array $urls The URLs of pages to re-fetch and cache. * @param bool $removeAll Remove all stale cache files (default TRUE). */ - function rebuildCache($urls, $removeAll = true) { + public function rebuildCache($urls, $removeAll = true) { if(!is_array($urls)) { // $urls must be an array @@ -117,7 +117,7 @@ class RebuildStaticCacheTask extends Controller { echo "\n\n== Done! =="; } - function show() { + public function show() { $urls = singleton('Page')->allPagesToCache(); echo "
\n"; print_r($urls); diff --git a/tasks/RemoveOrphanedPagesTask.php b/tasks/RemoveOrphanedPagesTask.php index 84ed0955..d2aeaaf5 100644 --- a/tasks/RemoveOrphanedPagesTask.php +++ b/tasks/RemoveOrphanedPagesTask.php @@ -48,11 +48,11 @@ in the other stage:
protected $orphanedSearchClass = 'SiteTree'; - function Link() { + public function Link() { return $this->class; } - function init() { + public function init() { parent::init(); if(!Permission::check('ADMIN')) { @@ -60,7 +60,7 @@ in the other stage:
} } - function index() { + public function index() { Requirements::javascript(FRAMEWORK_DIR . '/thirdparty/jquery/jquery.js'); Requirements::customCSS('#OrphanIDs .middleColumn {width: auto;}'); Requirements::customCSS('#OrphanIDs label {display: inline;}'); @@ -68,7 +68,7 @@ in the other stage:
return $this->renderWith('BlankPage'); } - function Form() { + public function Form() { $fields = new FieldList(); $source = array(); @@ -179,11 +179,11 @@ in the other stage:
return $form; } - function run($request) { + public function run($request) { // @todo Merge with BuildTask functionality } - function doSubmit($data, $form) { + public function doSubmit($data, $form) { set_time_limit(60*10); // 10 minutes if(!isset($data['OrphanIDs']) || !isset($data['OrphanOperation'])) return false; @@ -321,7 +321,7 @@ in the other stage:
* @param int|array $limit * @return SS_List */ - function getOrphanedPages($class = 'SiteTree', $filter = '', $sort = null, $join = null, $limit = null) { + public function getOrphanedPages($class = 'SiteTree', $filter = '', $sort = null, $join = null, $limit = null) { $filter .= ($filter) ? ' AND ' : ''; $filter .= sprintf("\"%s\".\"ParentID\" != 0 AND \"Parents\".\"ID\" IS NULL", $class); diff --git a/tasks/SiteTreeMaintenanceTask.php b/tasks/SiteTreeMaintenanceTask.php index 5753c313..0c1f4f91 100644 --- a/tasks/SiteTreeMaintenanceTask.php +++ b/tasks/SiteTreeMaintenanceTask.php @@ -8,7 +8,7 @@ class SiteTreeMaintenanceTask extends Controller { '*' => 'ADMIN' ); - function makelinksunique() { + public function makelinksunique() { $badURLs = "'" . implode("', '", DB::query("SELECT URLSegment, count(*) FROM SiteTree GROUP BY URLSegment HAVING count(*) > 1")->column()) . "'"; $pages = DataObject::get("SiteTree", "\"URLSegment\" IN ($badURLs)"); diff --git a/tasks/UpgradeSiteTreePermissionSchemaTask.php b/tasks/UpgradeSiteTreePermissionSchemaTask.php index 192f59ff..e6d99f45 100644 --- a/tasks/UpgradeSiteTreePermissionSchemaTask.php +++ b/tasks/UpgradeSiteTreePermissionSchemaTask.php @@ -18,7 +18,7 @@ class UpgradeSiteTreePermissionSchemaTask extends BuildTask { See http://open.silverstripe.com/ticket/2847 "; - function run($request) { + public function run($request) { // transfer values for changed column name foreach(array('SiteTree','SiteTree_Live','SiteTree_versions') as $table) { DB::query("UPDATE \"{$table}\" SET \"CanViewType\" = 'Viewers';"); diff --git a/templates/ContentController.ss b/templates/ContentController.ss deleted file mode 100644 index 505177a3..00000000 --- a/templates/ContentController.ss +++ /dev/null @@ -1,15 +0,0 @@ - - - - - <% base_tag %> - $MetaTags - - -$Title
- $Content - $Form - -Generated with the default ContentController.ss template
- - diff --git a/tests/controller/CMSMainTest.php b/tests/controller/CMSMainTest.php index 14e5f74c..01813b15 100644 --- a/tests/controller/CMSMainTest.php +++ b/tests/controller/CMSMainTest.php @@ -11,7 +11,7 @@ class CMSMainTest extends FunctionalTest { static protected $orig = array(); - static function set_up_once() { + static public function set_up_once() { self::$orig['CMSBatchActionHandler_batch_actions'] = CMSBatchActionHandler::$batch_actions; CMSBatchActionHandler::$batch_actions = array( 'publish' => 'CMSBatchAction_Publish', @@ -22,7 +22,7 @@ class CMSMainTest extends FunctionalTest { parent::set_up_once(); } - static function tear_down_once() { + static public function tear_down_once() { CMSBatchActionHandler::$batch_actions = self::$orig['CMSBatchActionHandler_batch_actions']; parent::tear_down_once(); @@ -31,7 +31,7 @@ class CMSMainTest extends FunctionalTest { /** * @todo Test the results of a publication better */ - function testPublish() { + public function testPublish() { $page1 = $this->objFromFixture('Page', "page1"); $page2 = $this->objFromFixture('Page', "page2"); $this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin')); @@ -74,7 +74,7 @@ class CMSMainTest extends FunctionalTest { /** * Test publication of one of every page type */ - function testPublishOneOfEachKindOfPage() { + public function testPublishOneOfEachKindOfPage() { return; $classes = ClassInfo::subclassesFor("SiteTree"); array_shift($classes); @@ -100,7 +100,7 @@ class CMSMainTest extends FunctionalTest { * Test that getCMSFields works on each page type. * Mostly, this is just checking that the method doesn't return an error */ - function testThatGetCMSFieldsWorksOnEveryPageType() { + public function testThatGetCMSFieldsWorksOnEveryPageType() { $classes = ClassInfo::subclassesFor("SiteTree"); array_shift($classes); @@ -118,7 +118,7 @@ class CMSMainTest extends FunctionalTest { } } - function testCanPublishPageWithUnpublishedParentWithStrictHierarchyOff() { + public function testCanPublishPageWithUnpublishedParentWithStrictHierarchyOff() { $this->logInWithPermission('ADMIN'); SiteTree::set_enforce_strict_hierarchy(true); @@ -139,7 +139,7 @@ class CMSMainTest extends FunctionalTest { /** * Test that a draft-deleted page can still be opened in the CMS */ - function testDraftDeletedPageCanBeOpenedInCMS() { + public function testDraftDeletedPageCanBeOpenedInCMS() { $this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin')); // Set up a page that is delete from live @@ -161,7 +161,7 @@ class CMSMainTest extends FunctionalTest { /** * Test CMSMain::getRecord() */ - function testGetRecord() { + public function testGetRecord() { // Set up a page that is delete from live $page1 = $this->objFromFixture('Page','page1'); $page1ID = $page1->ID; @@ -185,14 +185,14 @@ class CMSMainTest extends FunctionalTest { } - function testDeletedPagesSiteTreeFilter() { + public function testDeletedPagesSiteTreeFilter() { $id = $this->idFromFixture('Page', 'page3'); $this->logInWithPermission('ADMIN'); $result = $this->get('admin/pages/getsubtree?filter=CMSSiteTreeFilter_DeletedPages&ajax=1&ID=' . $id); $this->assertEquals(200, $result->getStatusCode()); } - function testCreationOfTopLevelPage(){ + public function testCreationOfTopLevelPage(){ $cmsUser = $this->objFromFixture('Member', 'allcmssectionsuser'); $rootEditUser = $this->objFromFixture('Member', 'rootedituser'); @@ -222,7 +222,7 @@ class CMSMainTest extends FunctionalTest { $this->session()->inst_set('loggedInAs', NULL); } - function testCreationOfRestrictedPage(){ + public function testCreationOfRestrictedPage(){ $adminUser = $this->objFromFixture('Member', 'admin'); $adminUser->logIn(); @@ -260,7 +260,7 @@ class CMSMainTest extends FunctionalTest { $this->session()->inst_set('loggedInAs', NULL); } - function testBreadcrumbs() { + public function testBreadcrumbs() { $page3 = $this->objFromFixture('Page', 'page3'); $page31 = $this->objFromFixture('Page', 'page31'); $adminuser = $this->objFromFixture('Member', 'admin'); diff --git a/tests/controller/CMSPageHistoryControllerTest.php b/tests/controller/CMSPageHistoryControllerTest.php index c88013a5..769b0466 100755 --- a/tests/controller/CMSPageHistoryControllerTest.php +++ b/tests/controller/CMSPageHistoryControllerTest.php @@ -12,7 +12,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest { private $versionUnpublishedCheck, $versionPublishCheck, $versionUnpublishedCheck2; private $page; - function setUp() { + public function setUp() { parent::setUp(); $this->loginWithPermission('ADMIN'); @@ -40,7 +40,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest { $this->versionPublishCheck2 = $this->page->Version; } - function testGetEditForm() { + public function testGetEditForm() { $controller = new CMSPageHistoryController(); // should get the latest version which we cannot rollback to @@ -84,7 +84,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest { * @todo should be less tied to cms theme. * @todo check highlighting for comparing pages. */ - function testVersionsForm() { + public function testVersionsForm() { $history = $this->get('admin/pages/history/show/'. $this->page->ID); $form = $this->cssParser()->getBySelector("#Form_VersionsForm"); @@ -101,7 +101,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest { $this->assertEquals(4, count($rows)); } - function testVersionsFormTableContainsInformation() { + public function testVersionsFormTableContainsInformation() { $history = $this->get('admin/pages/history/show/'. $this->page->ID); $form = $this->cssParser()->getBySelector("#Form_VersionsForm"); $rows = $form[0]->xpath("fieldset/table/tbody/tr"); @@ -126,7 +126,7 @@ class CMSPageHistoryControllerTest extends FunctionalTest { $this->assertThat((string) $rows[1]->attributes()->class, $this->logicalNot($this->stringContains('active'))); } - function testVersionsFormSelectsUnpublishedCheckbox() { + public function testVersionsFormSelectsUnpublishedCheckbox() { $history = $this->get('admin/pages/history/show/'. $this->page->ID); $checkbox = $this->cssParser()->getBySelector("#Form_VersionsForm #ShowUnpublished input"); diff --git a/tests/controller/CMSSiteTreeFilterTest.php b/tests/controller/CMSSiteTreeFilterTest.php index 64547d5b..110349e0 100644 --- a/tests/controller/CMSSiteTreeFilterTest.php +++ b/tests/controller/CMSSiteTreeFilterTest.php @@ -3,7 +3,7 @@ class CMSSiteTreeFilterTest extends SapphireTest { static $fixture_file = 'CMSSiteTreeFilterTest.yml'; - function testSearchFilterEmpty() { + public function testSearchFilterEmpty() { $page1 = $this->objFromFixture('Page', 'page1'); $page2 = $this->objFromFixture('Page', 'page2'); @@ -14,7 +14,7 @@ class CMSSiteTreeFilterTest extends SapphireTest { $this->assertTrue($f->isPageIncluded($page2)); } - function testSearchFilterByTitle() { + public function testSearchFilterByTitle() { $page1 = $this->objFromFixture('Page', 'page1'); $page2 = $this->objFromFixture('Page', 'page2'); @@ -30,7 +30,7 @@ class CMSSiteTreeFilterTest extends SapphireTest { ); } - function testIncludesParentsForNestedMatches() { + public function testIncludesParentsForNestedMatches() { $parent = $this->objFromFixture('Page', 'page3'); $child = $this->objFromFixture('Page', 'page3b'); @@ -46,7 +46,7 @@ class CMSSiteTreeFilterTest extends SapphireTest { ); } - function testChangedPagesFilter() { + public function testChangedPagesFilter() { $unchangedPage = $this->objFromFixture('Page', 'page1'); $unchangedPage->doPublish(); @@ -68,7 +68,7 @@ class CMSSiteTreeFilterTest extends SapphireTest { ); } - function testDeletedPagesFilter() { + public function testDeletedPagesFilter() { $deletedPage = $this->objFromFixture('Page', 'page2'); $deletedPage->publish('Stage', 'Live'); $deletedPageID = $deletedPage->ID; diff --git a/tests/controller/ContentControllerSearchExtensionTest.php b/tests/controller/ContentControllerSearchExtensionTest.php index bc89f40b..cf791770 100644 --- a/tests/controller/ContentControllerSearchExtensionTest.php +++ b/tests/controller/ContentControllerSearchExtensionTest.php @@ -1,7 +1,7 @@ orig['nested_urls'] = SiteTree::nested_urls(); @@ -32,7 +32,7 @@ class ModelAsControllerTest extends FunctionalTest { * This setup will enable nested-urls for this test and resets the state * after the tests have been performed. */ - function tearDown() { + public function tearDown() { if (isset($this->orig['nested_urls']) && !$this->orig['nested_urls']) { SiteTree::disable_nested_urls(); @@ -131,7 +131,7 @@ class ModelAsControllerTest extends FunctionalTest { $response->getHeader("Location")); } - function testDoesntRedirectToNestedChildrenOutsideOfOwnHierarchy() { + public function testDoesntRedirectToNestedChildrenOutsideOfOwnHierarchy() { $this->generateNestedPagesFixture(); $otherParent = new Page(array( @@ -156,7 +156,7 @@ class ModelAsControllerTest extends FunctionalTest { * NOTE: This test requires nested_urls * */ - function testRedirectsNestedRenamedPagesWithGetParameters() { + public function testRedirectsNestedRenamedPagesWithGetParameters() { $this->generateNestedPagesFixture(); // check third level URLSegment @@ -173,7 +173,7 @@ class ModelAsControllerTest extends FunctionalTest { * NOTE: This test requires nested_urls * */ - function testDoesntRedirectToNestedRenamedPageWhenNewExists() { + public function testDoesntRedirectToNestedRenamedPageWhenNewExists() { $this->generateNestedPagesFixture(); $otherLevel1 = new Page(array( @@ -202,7 +202,7 @@ class ModelAsControllerTest extends FunctionalTest { * NOTE: This test requires nested_urls * */ - function testFindOldPage(){ + public function testFindOldPage(){ $page = new Page(); $page->Title = 'First Level'; $page->URLSegment = 'oldurl'; @@ -239,7 +239,7 @@ class ModelAsControllerTest extends FunctionalTest { * * NOTE: This test requires nested_urls */ - function testChildOfDraft() { + public function testChildOfDraft() { RootURLController::reset(); SiteTree::enable_nested_urls(); diff --git a/tests/controller/SilverStripeNavigatorTest.php b/tests/controller/SilverStripeNavigatorTest.php index a89e4ce9..b0caec3f 100644 --- a/tests/controller/SilverStripeNavigatorTest.php +++ b/tests/controller/SilverStripeNavigatorTest.php @@ -8,7 +8,7 @@ class SilverStripeNavigatorTest extends SapphireTest { static $fixture_file = 'cms/tests/controller/CMSMainTest.yml'; - function testGetItems() { + public function testGetItems() { $page = $this->objFromFixture('Page', 'page1'); $navigator = new SilverStripeNavigator($page); @@ -23,7 +23,7 @@ class SilverStripeNavigatorTest extends SapphireTest { ); } - function testCanView() { + public function testCanView() { $page = $this->objFromFixture('Page', 'page1'); $admin = $this->objFromFixture('Member', 'admin'); $author = $this->objFromFixture('Member', 'assetsonlyuser'); @@ -47,7 +47,7 @@ class SilverStripeNavigatorTest_TestItem extends SilverStripeNavigatorItem imple } class SilverStripeNavigatorTest_ProtectedTestItem extends SilverStripeNavigatorItem implements TestOnly { - function canView($member = null) { + public function canView($member = null) { if(!$member) $member = Member::currentUser(); return Permission::checkMember($member, 'ADMIN'); } diff --git a/tests/model/ErrorPageTest.php b/tests/model/ErrorPageTest.php index c25c80aa..8e29f2d7 100644 --- a/tests/model/ErrorPageTest.php +++ b/tests/model/ErrorPageTest.php @@ -11,7 +11,7 @@ class ErrorPageTest extends FunctionalTest { protected $tmpAssetsPath = ''; - function setUp() { + public function setUp() { parent::setUp(); $this->orig['ErrorPage_staticfilepath'] = ErrorPage::get_static_filepath(); @@ -23,7 +23,7 @@ class ErrorPageTest extends FunctionalTest { Director::set_environment_type('live'); } - function tearDown() { + public function tearDown() { parent::tearDown(); ErrorPage::set_static_filepath($this->orig['ErrorPage_staticfilepath']); @@ -33,7 +33,7 @@ class ErrorPageTest extends FunctionalTest { Filesystem::removeFolder($this->tmpAssetsPath); } - function test404ErrorPage() { + public function test404ErrorPage() { $page = $this->objFromFixture('ErrorPage', '404'); // ensure that the errorpage exists as a physical file $page->publish('Stage', 'Live'); @@ -50,7 +50,7 @@ class ErrorPageTest extends FunctionalTest { $this->assertEquals($response->getStatusDescription(), 'Not Found', 'Status message of the HTTResponse for error page is "Not found"'); } - function testBehaviourOfShowInMenuAndShowInSearchFlags() { + public function testBehaviourOfShowInMenuAndShowInSearchFlags() { $page = $this->objFromFixture('ErrorPage', '404'); /* Don't show the error page in the menus */ diff --git a/tests/model/FileLinkTrackingTest.php b/tests/model/FileLinkTrackingTest.php index 2386ba6f..9dcf36ea 100644 --- a/tests/model/FileLinkTrackingTest.php +++ b/tests/model/FileLinkTrackingTest.php @@ -6,7 +6,7 @@ class FileLinkTrackingTest extends SapphireTest { static $fixture_file = "FileLinkTrackingTest.yml"; - function setUp() { + public function setUp() { parent::setUp(); $this->logInWithPermission('ADMIN'); @@ -16,7 +16,7 @@ class FileLinkTrackingTest extends SapphireTest { fclose($fh); } - function tearDown() { + public function tearDown() { parent::tearDown(); $testFiles = array( '/testscript-test-file.pdf', @@ -28,7 +28,7 @@ class FileLinkTrackingTest extends SapphireTest { } } - function testFileRenameUpdatesDraftAndPublishedPages() { + public function testFileRenameUpdatesDraftAndPublishedPages() { $page = $this->objFromFixture('Page', 'page1'); $this->assertTrue($page->doPublish()); $this->assertContains('ID")->value()); } - function testFileLinkRewritingOnVirtualPages() { + public function testFileLinkRewritingOnVirtualPages() { // Publish the source page $page = $this->objFromFixture('Page', 'page1'); $this->assertTrue($page->doPublish()); @@ -67,7 +67,7 @@ class FileLinkTrackingTest extends SapphireTest { DB::query("SELECT \"Content\" FROM \"SiteTree_Live\" WHERE \"ID\" = $svp->ID")->value()); } - function testLinkRewritingOnAPublishedPageDoesntMakeItEditedOnDraft() { + public function testLinkRewritingOnAPublishedPageDoesntMakeItEditedOnDraft() { // Publish the source page $page = $this->objFromFixture('Page', 'page1'); $this->assertTrue($page->doPublish()); @@ -86,7 +86,7 @@ class FileLinkTrackingTest extends SapphireTest { $this->assertFalse($page->IsModifiedOnStage); } - function testTwoFileRenamesInARowWork() { + public function testTwoFileRenamesInARowWork() { $page = $this->objFromFixture('Page', 'page1'); $this->assertTrue($page->doPublish()); $this->assertContains('assertEquals("http://www.google.com", $this->objFromFixture('RedirectorPage','goodexternal')->Link()); $this->assertEquals(Director::baseURL() . "redirection-dest/", $this->objFromFixture('RedirectorPage','goodinternal')->redirectionLink()); $this->assertEquals(Director::baseURL() . "redirection-dest/", $this->objFromFixture('RedirectorPage','goodinternal')->Link()); } - function testEmptyRedirectors() { + public function testEmptyRedirectors() { /* If a redirector page is misconfigured, then its link method will just return the usual URLSegment-generated value */ $page1 = $this->objFromFixture('RedirectorPage','badexternal'); $this->assertEquals(Director::baseURL() . 'bad-external/', $page1->Link()); @@ -27,7 +27,7 @@ class RedirectorPageTest extends FunctionalTest { $this->assertContains('message-setupWithoutRedirect', $content); } - function testReflexiveAndTransitiveInternalRedirectors() { + public function testReflexiveAndTransitiveInternalRedirectors() { /* Reflexive redirectors are those that point to themselves. They should behave the same as an empty redirector */ $page = $this->objFromFixture('RedirectorPage','reflexive'); $this->assertEquals(Director::baseURL() . 'reflexive/', $page->Link()); @@ -44,7 +44,7 @@ class RedirectorPageTest extends FunctionalTest { $this->assertEquals(Director::baseURL() . "redirection-dest/", $response->getHeader("Location")); } - function testExternalURLGetsPrefixIfNotSet() { + public function testExternalURLGetsPrefixIfNotSet() { $page = $this->objFromFixture('RedirectorPage', 'externalnoprefix'); $this->assertEquals($page->ExternalURL, 'http://google.com', 'onBeforeWrite has prefixed with http'); $page->write(); diff --git a/tests/model/SiteConfigTest.php b/tests/model/SiteConfigTest.php index 3bf10f1b..a54f0762 100644 --- a/tests/model/SiteConfigTest.php +++ b/tests/model/SiteConfigTest.php @@ -12,7 +12,7 @@ class SiteConfigTest extends SapphireTest { 'SiteTree' => array('SiteTreeSubsites') ); - function testAvailableThemes() { + public function testAvailableThemes() { $config = SiteConfig::current_site_config(); $ds = DIRECTORY_SEPARATOR; $testThemeBaseDir = TEMP_FOLDER . $ds . 'test-themes'; diff --git a/tests/model/SiteTreeActionsTest.php b/tests/model/SiteTreeActionsTest.php index f49cd18d..4a29ac62 100644 --- a/tests/model/SiteTreeActionsTest.php +++ b/tests/model/SiteTreeActionsTest.php @@ -16,19 +16,19 @@ class SiteTreeActionsTest extends FunctionalTest { static $fixture_file = 'SiteTreeActionsTest.yml'; - static function set_up_once() { + static public function set_up_once() { SiteTreeTest::set_up_once(); parent::set_up_once(); } - static function tear_down_once() { + static public function tear_down_once() { SiteTreeTest::tear_down_once(); parent::tear_down_once(); } - function testActionsReadonly() { + public function testActionsReadonly() { if(class_exists('SiteTreeCMSWorkflow')) return true; $readonlyEditor = $this->objFromFixture('Member', 'cmsreadonlyeditor'); @@ -50,7 +50,7 @@ class SiteTreeActionsTest extends FunctionalTest { $this->assertNull($actions->dataFieldByName('action_revert')); } - function testActionsNoDeletePublishedRecord() { + public function testActionsNoDeletePublishedRecord() { if(class_exists('SiteTreeCMSWorkflow')) return true; $this->logInWithPermission('ADMIN'); @@ -79,7 +79,7 @@ class SiteTreeActionsTest extends FunctionalTest { $this->assertNotNull($actions->dataFieldByName('action_deletefromlive')); } - function testActionsPublishedRecord() { + public function testActionsPublishedRecord() { if(class_exists('SiteTreeCMSWorkflow')) return true; $author = $this->objFromFixture('Member', 'cmseditor'); @@ -101,7 +101,7 @@ class SiteTreeActionsTest extends FunctionalTest { $this->assertNull($actions->dataFieldByName('action_revert')); } - function testActionsDeletedFromStageRecord() { + public function testActionsDeletedFromStageRecord() { if(class_exists('SiteTreeCMSWorkflow')) return true; $author = $this->objFromFixture('Member', 'cmseditor'); @@ -129,7 +129,7 @@ class SiteTreeActionsTest extends FunctionalTest { $this->assertNotNull($actions->dataFieldByName('action_revert')); } - function testActionsChangedOnStageRecord() { + public function testActionsChangedOnStageRecord() { if(class_exists('SiteTreeCMSWorkflow')) return true; $author = $this->objFromFixture('Member', 'cmseditor'); @@ -153,7 +153,7 @@ class SiteTreeActionsTest extends FunctionalTest { $this->assertNull($actions->dataFieldByName('action_revert')); } - function testActionsViewingOldVersion() { + public function testActionsViewingOldVersion() { $p = new Page(); $p->Content = 'test page first version'; $p->write(); @@ -175,11 +175,11 @@ class SiteTreeActionsTest extends FunctionalTest { } class SiteTreeActionsTest_Page extends Page implements TestOnly { - function canEdit($member = null) { + public function canEdit($member = null) { return Permission::checkMember($member, 'SiteTreeActionsTest_Page_CANEDIT'); } - function canDelete($member = null) { + public function canDelete($member = null) { return Permission::checkMember($member, 'SiteTreeActionsTest_Page_CANDELETE'); } } diff --git a/tests/model/SiteTreeBacklinksTest.php b/tests/model/SiteTreeBacklinksTest.php index af8e5903..ff5f089e 100644 --- a/tests/model/SiteTreeBacklinksTest.php +++ b/tests/model/SiteTreeBacklinksTest.php @@ -7,19 +7,19 @@ class SiteTreeBacklinksTest extends SapphireTest { 'SiteTree' => array('SiteTreeBacklinksTest_DOD'), ); - static function set_up_once() { + static public function set_up_once() { SiteTreeTest::set_up_once(); parent::set_up_once(); } - static function tear_down_once() { + static public function tear_down_once() { SiteTreeTest::tear_down_once(); parent::tear_down_once(); } - function setUp() { + public function setUp() { parent::setUp(); // Log in as admin so that we don't run into permission issues. That's not what we're @@ -27,7 +27,7 @@ class SiteTreeBacklinksTest extends SapphireTest { $this->logInWithPermission('ADMIN'); } - function testSavingPageWithLinkAddsBacklink() { + public function testSavingPageWithLinkAddsBacklink() { // load page 1 $page1 = $this->objFromFixture('Page', 'page1'); @@ -46,7 +46,7 @@ class SiteTreeBacklinksTest extends SapphireTest { $this->assertContains($page2->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 2 exists'); } - function testRemovingLinkFromPageRemovesBacklink() { + public function testRemovingLinkFromPageRemovesBacklink() { // load page 1 $page1 = $this->objFromFixture('Page', 'page1'); @@ -65,7 +65,7 @@ class SiteTreeBacklinksTest extends SapphireTest { $this->assertNotContains($page3->ID, $page1->BackLinkTracking()->column('ID'), 'Assert backlink to page 3 doesn\'t exist'); } - function testChangingUrlOnDraftSiteRewritesLink() { + public function testChangingUrlOnDraftSiteRewritesLink() { // load page 1 $page1 = $this->objFromFixture('Page', 'page1'); @@ -89,7 +89,7 @@ class SiteTreeBacklinksTest extends SapphireTest { $this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3'); } - function testChangingUrlOnLiveSiteRewritesLink() { + public function testChangingUrlOnLiveSiteRewritesLink() { // publish page 1 & 3 $page1 = $this->objFromFixture('Page', 'page1'); $page3 = $this->objFromFixture('Page', 'page3'); @@ -120,7 +120,7 @@ class SiteTreeBacklinksTest extends SapphireTest { $this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new url exists on page 3'); } - function testPublishingPageWithModifiedUrlRewritesLink() { + public function testPublishingPageWithModifiedUrlRewritesLink() { // publish page 1 & 3 $page1 = $this->objFromFixture('Page', 'page1'); $page3 = $this->objFromFixture('Page', 'page3'); @@ -155,7 +155,7 @@ class SiteTreeBacklinksTest extends SapphireTest { $this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s new published url exists on page 3'); } - function testPublishingPageWithModifiedLinksRewritesLinks() { + public function testPublishingPageWithModifiedLinksRewritesLinks() { // publish page 1 & 3 $page1 = $this->objFromFixture('Page', 'page1'); $page3 = $this->objFromFixture('Page', 'page3'); @@ -195,7 +195,7 @@ class SiteTreeBacklinksTest extends SapphireTest { $this->assertContains(Director::baseURL().'new-url-segment/', $links, 'Assert hyperlink to page 1\'s current published url exists on page 3'); } - function testLinkTrackingOnExtraContentFields() { + public function testLinkTrackingOnExtraContentFields() { $page1 = $this->objFromFixture('Page', 'page1'); $page2 = $this->objFromFixture('Page', 'page2'); $page1->doPublish(); @@ -248,7 +248,7 @@ class SiteTreeBacklinksTest_DOD extends DataExtension implements TestOnly { 'ExtraContent' => 'HTMLText', ); - function updateCMSFields(FieldList $fields) { + public function updateCMSFields(FieldList $fields) { $fields->addFieldToTab("Root.Content", new HTMLEditorField("ExtraContent")); } } diff --git a/tests/model/SiteTreeBrokenLinksTest.php b/tests/model/SiteTreeBrokenLinksTest.php index e330e621..5333f3ab 100644 --- a/tests/model/SiteTreeBrokenLinksTest.php +++ b/tests/model/SiteTreeBrokenLinksTest.php @@ -6,19 +6,19 @@ class SiteTreeBrokenLinksTest extends SapphireTest { static $fixture_file = 'SiteTreeBrokenLinksTest.yml'; - static function set_up_once() { + static public function set_up_once() { SiteTreeTest::set_up_once(); parent::set_up_once(); } - static function tear_down_once() { + static public function tear_down_once() { SiteTreeTest::tear_down_once(); parent::tear_down_once(); } - function testBrokenLinksBetweenPages() { + public function testBrokenLinksBetweenPages() { $obj = $this->objFromFixture('Page','content'); $obj->Content = 'this is a broken link'; @@ -30,7 +30,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest { $this->assertFalse($obj->HasBrokenLink, 'Page does NOT have a broken link'); } - function testBrokenVirtualPages() { + public function testBrokenVirtualPages() { $obj = $this->objFromFixture('Page','content'); $vp = new VirtualPage(); @@ -43,7 +43,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest { $this->assertTrue($vp->HasBrokenLink, 'Broken virtual page IS marked as such'); } - function testBrokenInternalRedirectorPages() { + public function testBrokenInternalRedirectorPages() { $obj = $this->objFromFixture('Page','content'); $rp = new RedirectorPage(); @@ -58,7 +58,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest { $this->assertTrue($rp->HasBrokenLink, 'Broken redirector page IS marked as such'); } - function testBrokenAssetLinks() { + public function testBrokenAssetLinks() { $obj = $this->objFromFixture('Page','content'); $obj->Content = 'this is a broken link to a pdf file'; @@ -70,7 +70,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest { $this->assertFalse($obj->HasBrokenFile, 'Page does NOT have a broken file'); } - function testDeletingFileMarksBackedPagesAsBroken() { + public function testDeletingFileMarksBackedPagesAsBroken() { // Test entry $file = new File(); $file->Filename = 'test-file.pdf'; @@ -99,7 +99,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest { $liveObj = Versioned::get_one_by_stage("SiteTree", "Live", "\"SiteTree\".\"ID\" = $obj->ID"); $this->assertEquals(1, $liveObj->HasBrokenFile); } - function testDeletingMarksBackLinkedPagesAsBroken() { + public function testDeletingMarksBackLinkedPagesAsBroken() { $this->logInWithPermission('ADMIN'); // Set up two published pages with a link from content -> about @@ -142,7 +142,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest { WHERE \"ID\" = $linkSrc->ID")->value()); } - function testPublishingSourceBeforeDestHasBrokenLink() { + public function testPublishingSourceBeforeDestHasBrokenLink() { $this->logInWithPermission('ADMIN'); // Set up two draft pages with a link from content -> about @@ -164,7 +164,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest { } - function testRestoreFixesBrokenLinks() { + public function testRestoreFixesBrokenLinks() { // Create page and virutal page $p = new Page(); $p->Title = "source"; @@ -239,7 +239,7 @@ class SiteTreeBrokenLinksTest extends SapphireTest { } - function testRevertToLiveFixesBrokenLinks() { + public function testRevertToLiveFixesBrokenLinks() { // Create page and virutal page $p = new Page(); $p->Title = "source"; diff --git a/tests/model/SiteTreePermissionsTest.php b/tests/model/SiteTreePermissionsTest.php index a2c19836..0992306e 100644 --- a/tests/model/SiteTreePermissionsTest.php +++ b/tests/model/SiteTreePermissionsTest.php @@ -13,19 +13,19 @@ class SiteTreePermissionsTest extends FunctionalTest { 'SiteTree' => array('SiteTreeSubsites') ); - static function set_up_once() { + static public function set_up_once() { SiteTreeTest::set_up_once(); parent::set_up_once(); } - static function tear_down_once() { + static public function tear_down_once() { SiteTreeTest::tear_down_once(); parent::tear_down_once(); } - function setUp() { + public function setUp() { parent::setUp(); $this->useDraftSite(); @@ -35,7 +35,7 @@ class SiteTreePermissionsTest extends FunctionalTest { } - function testAccessingStageWithBlankStage() { + public function testAccessingStageWithBlankStage() { $this->useDraftSite(false); $this->autoFollowRedirection = false; @@ -68,7 +68,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->assertEquals($response->getStatusCode(), '404'); } - function testPermissionCheckingWorksOnDeletedPages() { + public function testPermissionCheckingWorksOnDeletedPages() { // Set up fixture - a published page deleted from draft $this->logInWithPermission("ADMIN"); $page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup'); @@ -94,7 +94,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->assertTrue($page->canEdit()); } - function testPermissionCheckingWorksOnUnpublishedPages() { + public function testPermissionCheckingWorksOnUnpublishedPages() { // Set up fixture - an unpublished page $this->logInWithPermission("ADMIN"); $page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup'); @@ -116,7 +116,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->assertTrue($page->canEdit()); } - function testCanEditOnPageDeletedFromStageAndLiveReturnsFalse() { + public function testCanEditOnPageDeletedFromStageAndLiveReturnsFalse() { // Find a page that exists and delete it from both stage and published $this->logInWithPermission("ADMIN"); $page = $this->objFromFixture('Page','restrictedEditOnlySubadminGroup'); @@ -134,7 +134,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->assertFalse($page->canEdit()); } - function testCanViewStage() { + public function testCanViewStage() { $page = $this->objFromFixture('Page', 'standardpage'); $editor = $this->objFromFixture('Member', 'editor'); $websiteuser = $this->objFromFixture('Member', 'websiteuser'); @@ -146,7 +146,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->assertTrue($page->canViewStage('Stage', $editor)); } - function testAccessTabOnlyDisplaysWithGrantAccessPermissions() { + public function testAccessTabOnlyDisplaysWithGrantAccessPermissions() { $page = $this->objFromFixture('Page', 'standardpage'); $subadminuser = $this->objFromFixture('Member', 'subadmin'); @@ -176,7 +176,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->session()->inst_set('loggedInAs', null); } - function testRestrictedViewLoggedInUsers() { + public function testRestrictedViewLoggedInUsers() { $page = $this->objFromFixture('Page', 'restrictedViewLoggedInUsers'); // unauthenticated users @@ -208,7 +208,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->session()->inst_set('loggedInAs', null); } - function testRestrictedViewOnlyTheseUsers() { + public function testRestrictedViewOnlyTheseUsers() { $page = $this->objFromFixture('Page', 'restrictedViewOnlyWebsiteUsers'); // unauthenticcated users @@ -255,7 +255,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->session()->inst_set('loggedInAs', null); } - function testRestrictedEditLoggedInUsers() { + public function testRestrictedEditLoggedInUsers() { $page = $this->objFromFixture('Page', 'restrictedEditLoggedInUsers'); // unauthenticcated users @@ -280,7 +280,7 @@ class SiteTreePermissionsTest extends FunctionalTest { ); } - function testRestrictedEditOnlySubadminGroup() { + public function testRestrictedEditOnlySubadminGroup() { $page = $this->objFromFixture('Page', 'restrictedEditOnlySubadminGroup'); // unauthenticated users @@ -304,7 +304,7 @@ class SiteTreePermissionsTest extends FunctionalTest { ); } - function testRestrictedViewInheritance() { + public function testRestrictedViewInheritance() { $parentPage = $this->objFromFixture('Page', 'parent_restrictedViewOnlySubadminGroup'); $childPage = $this->objFromFixture('Page', 'child_restrictedViewOnlySubadminGroup'); @@ -337,7 +337,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->session()->inst_set('loggedInAs', null); } - function testRestrictedEditInheritance() { + public function testRestrictedEditInheritance() { $parentPage = $this->objFromFixture('Page', 'parent_restrictedEditOnlySubadminGroup'); $childPage = $this->objFromFixture('Page', 'child_restrictedEditOnlySubadminGroup'); @@ -355,7 +355,7 @@ class SiteTreePermissionsTest extends FunctionalTest { ); } - function testDeleteRestrictedChild() { + public function testDeleteRestrictedChild() { $parentPage = $this->objFromFixture('Page', 'deleteTestParentPage'); $childPage = $this->objFromFixture('Page', 'deleteTestChildPage'); @@ -370,7 +370,7 @@ class SiteTreePermissionsTest extends FunctionalTest { ); } - function testRestrictedEditLoggedInUsersDeletedFromStage() { + public function testRestrictedEditLoggedInUsersDeletedFromStage() { $page = $this->objFromFixture('Page', 'restrictedEditLoggedInUsers'); $pageID = $page->ID; @@ -391,7 +391,7 @@ class SiteTreePermissionsTest extends FunctionalTest { ); } - function testInheritCanViewFromSiteConfig() { + public function testInheritCanViewFromSiteConfig() { $page = $this->objFromFixture('Page', 'inheritWithNoParent'); $siteconfig = $this->objFromFixture('SiteConfig', 'default'); $editor = $this->objFromFixture('Member', 'editor'); @@ -416,7 +416,7 @@ class SiteTreePermissionsTest extends FunctionalTest { $this->assertFalse($page->canView(FALSE), 'Anonymous can\'t view a page when set to inherit from the SiteConfig, and SiteConfig has canView set to OnlyTheseUsers'); } - function testInheritCanEditFromSiteConfig() { + public function testInheritCanEditFromSiteConfig() { $page = $this->objFromFixture('Page', 'inheritWithNoParent'); $siteconfig = $this->objFromFixture('SiteConfig', 'default'); $editor = $this->objFromFixture('Member', 'editor'); diff --git a/tests/model/SiteTreeTest.php b/tests/model/SiteTreeTest.php index c8a74551..5f007040 100644 --- a/tests/model/SiteTreeTest.php +++ b/tests/model/SiteTreeTest.php @@ -25,7 +25,7 @@ class SiteTreeTest extends SapphireTest { */ static protected $origTranslatableSettings = array(); - static function set_up_once() { + static public function set_up_once() { // needs to recreate the database schema with language properties self::kill_temp_db(); @@ -51,7 +51,7 @@ class SiteTreeTest extends SapphireTest { parent::set_up_once(); } - static function tear_down_once() { + static public function tear_down_once() { if(class_exists('Translatable')) { if(self::$origTranslatableSettings['has_extension']) { Object::add_extension('SiteTree', 'Translatable'); @@ -69,7 +69,7 @@ class SiteTreeTest extends SapphireTest { parent::tear_down_once(); } - function testCreateDefaultpages() { + public function testCreateDefaultpages() { $remove = DataObject::get('SiteTree'); if($remove) foreach($remove as $page) $page->delete(); // Make sure the table is empty @@ -97,7 +97,7 @@ class SiteTreeTest extends SapphireTest { * - Resolves duplicates by appending a number * - renames classes with a class name conflict */ - function testURLGeneration() { + public function testURLGeneration() { $expectedURLs = array( 'home' => 'home', 'staff' => 'my-staff', @@ -121,7 +121,7 @@ class SiteTreeTest extends SapphireTest { /** * Test that publication copies data to SiteTree_Live */ - function testPublishCopiesToLiveTable() { + public function testPublishCopiesToLiveTable() { $obj = $this->objFromFixture('Page','about'); $obj->publish('Stage', 'Live'); @@ -132,7 +132,7 @@ class SiteTreeTest extends SapphireTest { /** * Test that field which are set and then cleared are also transferred to the published site. */ - function testPublishDeletedFields() { + public function testPublishDeletedFields() { $this->logInWithPermission('ADMIN'); $obj = $this->objFromFixture('Page', 'about'); @@ -150,7 +150,7 @@ class SiteTreeTest extends SapphireTest { } - function testParentNodeCachedInMemory() { + public function testParentNodeCachedInMemory() { $parent = new SiteTree(); $parent->Title = 'Section Title'; $child = new SiteTree(); @@ -161,7 +161,7 @@ class SiteTreeTest extends SapphireTest { $this->assertEquals("Section Title", $child->Parent->Title); } - function testParentModelReturnType() { + public function testParentModelReturnType() { $parent = new SiteTreeTest_PageNode(); $child = new SiteTreeTest_PageNode(); @@ -172,7 +172,7 @@ class SiteTreeTest extends SapphireTest { /** * Confirm that DataObject::get_one() gets records from SiteTree_Live */ - function testGetOneFromLive() { + public function testGetOneFromLive() { $s = new SiteTree(); $s->Title = "V1"; $s->URLSegment = "get-one-test-page"; @@ -190,7 +190,7 @@ class SiteTreeTest extends SapphireTest { Versioned::set_reading_mode($oldMode); } - function testChidrenOfRootAreTopLevelPages() { + public function testChidrenOfRootAreTopLevelPages() { $pages = DataObject::get("SiteTree"); foreach($pages as $page) $page->publish('Stage', 'Live'); unset($pages); @@ -215,7 +215,7 @@ class SiteTreeTest extends SapphireTest { $this->assertNotContains('Staff', $allChildren); } - function testCanSaveBlankToHasOneRelations() { + public function testCanSaveBlankToHasOneRelations() { /* DataObject::write() should save to a has_one relationship if you set a field called (relname)ID */ $page = new SiteTree(); $parentID = $this->idFromFixture('Page', 'home'); @@ -229,7 +229,7 @@ class SiteTreeTest extends SapphireTest { $this->assertEquals(0, DB::query("SELECT \"ParentID\" FROM \"SiteTree\" WHERE \"ID\" = $page->ID")->value()); } - function testStageStates() { + public function testStageStates() { // newly created page $createdPage = new SiteTree(); $createdPage->write(); @@ -279,7 +279,7 @@ class SiteTreeTest extends SapphireTest { /** * Test that a page can be completely deleted and restored to the stage site */ - function testRestoreToStage() { + public function testRestoreToStage() { $page = $this->objFromFixture('Page', 'about'); $pageID = $page->ID; $page->delete(); @@ -345,7 +345,7 @@ class SiteTreeTest extends SapphireTest { ); } - function testRelativeLink() { + public function testRelativeLink() { $about = $this->objFromFixture('Page', 'about'); $staff = $this->objFromFixture('Page', 'staff'); @@ -357,7 +357,7 @@ class SiteTreeTest extends SapphireTest { $this->assertEquals('about-us/tom&jerry', $about->RelativeLink('tom&jerry'), 'Doesnt url encode parameter'); } - function testAbsoluteLiveLink() { + public function testAbsoluteLiveLink() { $parent = $this->objFromFixture('Page', 'about'); $child = $this->objFromFixture('Page', 'staff'); @@ -374,7 +374,7 @@ class SiteTreeTest extends SapphireTest { $this->assertStringEndsWith('changed-on-live/my-staff/?stage=Live', $child->getAbsoluteLiveLink()); } - function testDeleteFromStageOperatesRecursively() { + public function testDeleteFromStageOperatesRecursively() { SiteTree::set_enforce_strict_hierarchy(false); $pageAbout = $this->objFromFixture('Page', 'about'); $pageStaff = $this->objFromFixture('Page', 'staff'); @@ -388,7 +388,7 @@ class SiteTreeTest extends SapphireTest { SiteTree::set_enforce_strict_hierarchy(true); } - function testDeleteFromStageOperatesRecursivelyStrict() { + public function testDeleteFromStageOperatesRecursivelyStrict() { $pageAbout = $this->objFromFixture('Page', 'about'); $pageStaff = $this->objFromFixture('Page', 'staff'); $pageStaffDuplicate = $this->objFromFixture('Page', 'staffduplicate'); @@ -400,7 +400,7 @@ class SiteTreeTest extends SapphireTest { $this->assertFalse(DataObject::get_by_id('Page', $pageStaffDuplicate->ID)); } - function testDeleteFromLiveOperatesRecursively() { + public function testDeleteFromLiveOperatesRecursively() { SiteTree::set_enforce_strict_hierarchy(false); $this->logInWithPermission('ADMIN'); @@ -424,7 +424,7 @@ class SiteTreeTest extends SapphireTest { SiteTree::set_enforce_strict_hierarchy(true); } - function testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn() { + public function testUnpublishDoesNotDeleteChildrenWithLooseHierachyOn() { SiteTree::set_enforce_strict_hierarchy(false); $this->logInWithPermission('ADMIN'); @@ -447,7 +447,7 @@ class SiteTreeTest extends SapphireTest { } - function testDeleteFromLiveOperatesRecursivelyStrict() { + public function testDeleteFromLiveOperatesRecursivelyStrict() { $this->logInWithPermission('ADMIN'); $pageAbout = $this->objFromFixture('Page', 'about'); @@ -471,7 +471,7 @@ class SiteTreeTest extends SapphireTest { * Simple test to confirm that querying from a particular archive date doesn't throw * an error */ - function testReadArchiveDate() { + public function testReadArchiveDate() { Versioned::reading_archived_date('2009-07-02 14:05:07'); DataObject::get('SiteTree', "\"ParentID\" = 0"); @@ -479,7 +479,7 @@ class SiteTreeTest extends SapphireTest { Versioned::reading_archived_date(null); } - function testEditPermissions() { + public function testEditPermissions() { $editor = $this->objFromFixture("Member", "editor"); $home = $this->objFromFixture("Page", "home"); @@ -500,7 +500,7 @@ class SiteTreeTest extends SapphireTest { $this->assertFalse($product4->canEdit($editor)); } - function testEditPermissionsOnDraftVsLive() { + public function testEditPermissionsOnDraftVsLive() { // Create an inherit-permission page $page = new Page(); $page->write(); @@ -539,7 +539,7 @@ class SiteTreeTest extends SapphireTest { $this->assertTrue($page->canEdit()); } - function testCompareVersions() { + public function testCompareVersions() { // Necessary to avoid $oldCleanerClass = Diff::$html_cleaner_class; Diff::$html_cleaner_class = 'SiteTreeTest_NullHtmlCleaner'; @@ -565,7 +565,7 @@ class SiteTreeTest extends SapphireTest { Diff::$html_cleaner_class = $oldCleanerClass; } - function testAuthorIDAndPublisherIDFilledOutOnPublish() { + public function testAuthorIDAndPublisherIDFilledOutOnPublish() { // Ensure that we have a member ID who is doing all this work $member = Member::currentUser(); if($member) { @@ -785,13 +785,13 @@ class SiteTreeTest extends SapphireTest { } - function testPageTypeClasses() { + public function testPageTypeClasses() { $classes = SiteTree::page_type_classes(); $this->assertNotContains('SiteTree', $classes, 'Page types do not include base class'); $this->assertContains('Page', $classes, 'Page types do contain subclasses'); } - function testAllowedChildren() { + public function testAllowedChildren() { $page = new SiteTree(); $this->assertContains( 'VirtualPage', @@ -828,7 +828,7 @@ class SiteTreeTest extends SapphireTest { ); } - function testAllowedChildrenValidation() { + public function testAllowedChildrenValidation() { $page = new SiteTree(); $page->write(); $classA = new SiteTreeTest_ClassA(); @@ -867,7 +867,7 @@ class SiteTreeTest extends SapphireTest { $this->assertFalse($valid->valid(), "Doesnt allow child where only parent class is allowed on parent node, and asterisk prefixing is used"); } - function testClassDropdown() { + public function testClassDropdown() { $sitetree = new SiteTree(); $method = new ReflectionMethod($sitetree, 'getClassDropdown'); $method->setAccessible(true); @@ -884,7 +884,7 @@ class SiteTreeTest extends SapphireTest { Session::set("loggedInAs", null); } - function testCanBeRoot() { + public function testCanBeRoot() { $page = new SiteTree(); $page->ParentID = 0; $page->write(); @@ -902,14 +902,14 @@ class SiteTreeTest extends SapphireTest { if(!$isDetected) $this->fail('Fails validation with $can_be_root=false'); } - function testModifyStatusFlagByInheritance(){ + public function testModifyStatusFlagByInheritance(){ $node = new SiteTreeTest_StageStatusInherit(); $treeTitle = $node->getTreeTitle(); $this->assertContains('InheritedTitle', $treeTitle); $this->assertContains('inherited-class', $treeTitle); } - function testMenuTitleIsUnsetWhenEqualsTitle() { + public function testMenuTitleIsUnsetWhenEqualsTitle() { $page = new SiteTree(); $page->Title = 'orig'; $page->MenuTitle = 'orig'; @@ -956,7 +956,7 @@ class SiteTreeTest_Conflicted_Controller extends Page_Controller implements Test } class SiteTreeTest_NullHtmlCleaner extends HTMLCleaner { - function cleanHTML($html) { + public function cleanHTML($html) { return $html; } } @@ -992,7 +992,7 @@ class SiteTreeTest_NotRoot extends Page implements TestOnly { } class SiteTreeTest_StageStatusInherit extends SiteTree implements TestOnly { - function getStatusFlags($cached = true){ + public function getStatusFlags($cached = true){ $flags = parent::getStatusFlags($cached); $flags['inherited-class'] = "InheritedTitle"; return $flags; diff --git a/tests/model/VirtualPageTest.php b/tests/model/VirtualPageTest.php index cd47dfbb..ad383454 100644 --- a/tests/model/VirtualPageTest.php +++ b/tests/model/VirtualPageTest.php @@ -13,7 +13,7 @@ class VirtualPageTest extends SapphireTest { 'SiteTree' => array('VirtualPageTest_PageExtension') ); - function setUp() { + public function setUp() { parent::setUp(); $this->origInitiallyCopiedFields = VirtualPage::$initially_copied_fields; @@ -23,7 +23,7 @@ class VirtualPageTest extends SapphireTest { VirtualPage::$non_virtual_fields[] = 'MySharedNonVirtualField'; } - function tearDown() { + public function tearDown() { parent::tearDown(); VirtualPage::$initially_copied_fields = $this->origInitiallyCopiedFields; @@ -34,7 +34,7 @@ class VirtualPageTest extends SapphireTest { * Test that, after you update the source page of a virtual page, all the virtual pages * are updated */ - function testEditingSourcePageUpdatesVirtualPages() { + public function testEditingSourcePageUpdatesVirtualPages() { $master = $this->objFromFixture('Page', 'master'); $master->Title = "New title"; $master->MenuTitle = "New menutitle"; @@ -56,7 +56,7 @@ class VirtualPageTest extends SapphireTest { * Test that, after you publish the source page of a virtual page, all the already published * virtual pages are published */ - function testPublishingSourcePagePublishesAlreadyPublishedVirtualPages() { + public function testPublishingSourcePagePublishesAlreadyPublishedVirtualPages() { $this->logInWithPermission('ADMIN'); $master = $this->objFromFixture('Page', 'master'); @@ -93,7 +93,7 @@ class VirtualPageTest extends SapphireTest { /** * Test that virtual pages get the content from the master page when they are created. */ - function testNewVirtualPagesGrabTheContentFromTheirMaster() { + public function testNewVirtualPagesGrabTheContentFromTheirMaster() { $vp = new VirtualPage(); $vp->write(); @@ -115,7 +115,7 @@ class VirtualPageTest extends SapphireTest { * This means that when you publish them, they should show the published content of the source * page, not the draft content at the time when you clicked 'publish' in the CMS. */ - function testPublishingAVirtualPageCopiedPublishedContentNotDraftContent() { + public function testPublishingAVirtualPageCopiedPublishedContentNotDraftContent() { $p = new Page(); $p->Content = "published content"; $p->write(); @@ -140,7 +140,7 @@ class VirtualPageTest extends SapphireTest { DB::query('SELECT "Content" from "SiteTree_Live" WHERE "ID" = ' . $vp->ID)->value()); } - function testCantPublishVirtualPagesBeforeTheirSource() { + public function testCantPublishVirtualPagesBeforeTheirSource() { // An unpublished source page $p = new Page(); $p->Content = "test content"; @@ -161,7 +161,7 @@ class VirtualPageTest extends SapphireTest { $this->assertTrue($vp->canPublish()); } - function testCanDeleteOrphanedVirtualPagesFromLive() { + public function testCanDeleteOrphanedVirtualPagesFromLive() { // An unpublished source page $p = new Page(); $p->Content = "test content"; @@ -185,7 +185,7 @@ class VirtualPageTest extends SapphireTest { $this->assertNull(DB::query("SELECT \"ID\" FROM \"SiteTree_Live\" WHERE \"ID\" = $vp->ID")->value()); } - function testVirtualPagesArentInappropriatelyPublished() { + public function testVirtualPagesArentInappropriatelyPublished() { // Fixture $p = new Page(); $p->Content = "test content"; @@ -237,7 +237,7 @@ class VirtualPageTest extends SapphireTest { $this->assertFalse($vp->IsModifiedOnStage); } - function testVirtualPagesCreateVersionRecords() { + public function testVirtualPagesCreateVersionRecords() { $source = $this->objFromFixture('Page', 'master'); $source->Title = "T0"; $source->write(); @@ -275,7 +275,7 @@ class VirtualPageTest extends SapphireTest { WHERE \"RecordID\" = $vp->ID AND \"Version\" = $liveVersion")->value()); } - function fixVersionNumberCache($page) { + public function fixVersionNumberCache($page) { $pages = func_get_args(); foreach($pages as $p) { Versioned::prepopulate_versionnumber_cache('SiteTree', 'Stage', array($p->ID)); @@ -283,7 +283,7 @@ class VirtualPageTest extends SapphireTest { } } - function testUnpublishingSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() { + public function testUnpublishingSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() { // Create page and virutal page $p = new Page(); $p->Title = "source"; @@ -315,7 +315,7 @@ class VirtualPageTest extends SapphireTest { $this->assertEquals(1, $vp->HasBrokenLink); } - function testDeletingFromLiveSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() { + public function testDeletingFromLiveSourcePageOfAVirtualPageAlsoUnpublishesVirtualPage() { // Create page and virutal page $p = new Page(); $p->Title = "source"; @@ -352,7 +352,7 @@ class VirtualPageTest extends SapphireTest { /** * Base functionality tested in {@link SiteTreeTest->testAllowedChildrenValidation()}. */ - function testAllowedChildrenLimitedOnVirtualPages() { + public function testAllowedChildrenLimitedOnVirtualPages() { $classA = new SiteTreeTest_ClassA(); $classA->write(); $classB = new SiteTreeTest_ClassB(); @@ -375,7 +375,7 @@ class VirtualPageTest extends SapphireTest { $this->assertFalse($valid->valid(), "Doesn't allow child linked to virtual page type disallowed by parent"); } - function testGetVirtualFields() { + public function testGetVirtualFields() { // Needs association with an original, otherwise will just return the "base" virtual fields $page = new VirtualPageTest_ClassA(); $page->write(); @@ -388,7 +388,7 @@ class VirtualPageTest extends SapphireTest { $this->assertNotContains('MyInitiallyCopiedField', $virtual->getVirtualFields()); } - function testCopyFrom() { + public function testCopyFrom() { $original = new VirtualPageTest_ClassA(); $original->MyInitiallyCopiedField = 'original'; $original->MyVirtualField = 'original'; @@ -426,7 +426,7 @@ class VirtualPageTest extends SapphireTest { ); } - function testWriteWithoutVersion() { + public function testWriteWithoutVersion() { $original = new SiteTree(); $original->write(); // Create a second version (different behaviour), @@ -473,7 +473,7 @@ class VirtualPageTest extends SapphireTest { ); } - function testCanBeRoot() { + public function testCanBeRoot() { $page = new SiteTree(); $page->ParentID = 0; $page->write(); @@ -500,7 +500,7 @@ class VirtualPageTest extends SapphireTest { if(!$isDetected) $this->fail('Fails validation with $can_be_root=false'); } - function testPageTypeChangeDoesntKeepOrphanedVirtualPageRecord() { + public function testPageTypeChangeDoesntKeepOrphanedVirtualPageRecord() { $page = new SiteTree(); $page->write(); $page->publish('Stage', 'Live'); @@ -536,7 +536,7 @@ class VirtualPageTest extends SapphireTest { ); } - function testPageTypeChangePropagatesToLive() { + public function testPageTypeChangePropagatesToLive() { $page = new SiteTree(); $page->MySharedNonVirtualField = 'original'; $page->write(); diff --git a/tests/reports/ReportTest.php b/tests/reports/ReportTest.php index 1d4ae2f5..67b5de30 100644 --- a/tests/reports/ReportTest.php +++ b/tests/reports/ReportTest.php @@ -2,7 +2,7 @@ class ReportTest extends SapphireTest { - function testGetReports() { + public function testGetReports() { $reports = SS_Report::get_reports(); $this->assertNotNull($reports, "Reports returned"); $previousSort = 0; @@ -12,7 +12,7 @@ class ReportTest extends SapphireTest { } } - function testExcludeReport() { + public function testExcludeReport() { $reports = SS_Report::get_reports(); $reportNames = array(); foreach($reports as $report) { @@ -42,7 +42,7 @@ class ReportTest extends SapphireTest { $this->assertNotContains('ReportTest_FakeTest2',$reportNames,'ReportTest_FakeTest2 is NOT in reports list'); } - function testAbstractClassesAreExcluded() { + public function testAbstractClassesAreExcluded() { $reports = SS_Report::get_reports(); $reportNames = array(); foreach($reports as $report) { @@ -55,62 +55,62 @@ class ReportTest extends SapphireTest { } class ReportTest_FakeTest extends SS_Report implements TestOnly { - function title() { + public function title() { return 'Report title'; } - function columns() { + public function columns() { return array( "Title" => array( "title" => "Page Title" ) ); } - function sourceRecords($params, $sort, $limit) { + public function sourceRecords($params, $sort, $limit) { return new ArrayList(); } - function sort() { + public function sort() { return 100; } } class ReportTest_FakeTest2 extends SS_Report implements TestOnly { - function title() { + public function title() { return 'Report title 2'; } - function columns() { + public function columns() { return array( "Title" => array( "title" => "Page Title 2" ) ); } - function sourceRecords($params, $sort, $limit) { + public function sourceRecords($params, $sort, $limit) { return new ArrayList(); } - function sort() { + public function sort() { return 98; } } abstract class ReportTest_FakeTest_Abstract extends SS_Report implements TestOnly { - function title() { + public function title() { return 'Report title Abstract'; } - function columns() { + public function columns() { return array( "Title" => array( "title" => "Page Title Abstract" ) ); } - function sourceRecords($params, $sort, $limit) { + public function sourceRecords($params, $sort, $limit) { return new ArrayList(); } - function sort() { + public function sort() { return 5; } } diff --git a/tests/reports/SideReportTest.php b/tests/reports/SideReportTest.php index 5f02a9e3..3e12c1e1 100644 --- a/tests/reports/SideReportTest.php +++ b/tests/reports/SideReportTest.php @@ -10,7 +10,7 @@ class SideReportTest extends SapphireTest { static $daysAgo = 14; - function setUp() { + public function setUp() { parent::setUp(); // set the dates by hand: impossible to set via yml @@ -24,7 +24,7 @@ class SideReportTest extends SapphireTest { DB::query("UPDATE \"SiteTree\" SET \"Created\"='2009-01-01 00:00:00', \"LastEdited\"='".date('Y-m-d H:i:s', $beforeThreshold)."' WHERE \"ID\"='".$before->ID."'"); } - function testRecentlyEdited() { + public function testRecentlyEdited() { SS_Datetime::set_mock_now('31-06-2009 00:00:00'); $after = $this->objFromFixture('SiteTree', 'after'); diff --git a/tests/search/CMSMainSearchFormTest.php b/tests/search/CMSMainSearchFormTest.php index fe28c5aa..4577bea0 100644 --- a/tests/search/CMSMainSearchFormTest.php +++ b/tests/search/CMSMainSearchFormTest.php @@ -5,7 +5,7 @@ class CMSMainSearchFormTest extends FunctionalTest { protected $autoFollowRedirection = false; - function testTitleFilter() { + public function testTitleFilter() { $this->session()->inst_set('loggedInAs', $this->idFromFixture('Member', 'admin')); $response = $this->get( diff --git a/tests/search/SearchFormTest.php b/tests/search/SearchFormTest.php index 481e1bb4..c0794fa0 100644 --- a/tests/search/SearchFormTest.php +++ b/tests/search/SearchFormTest.php @@ -14,12 +14,12 @@ class ZZZSearchFormTest extends FunctionalTest { protected $mockController; - function waitUntilIndexingFinished() { + public function waitUntilIndexingFinished() { $db = DB::getConn(); if (method_exists($db, 'waitUntilIndexingFinished')) DB::getConn()->waitUntilIndexingFinished(); } - function setUpOnce() { + public function setUpOnce() { // HACK Postgres doesn't refresh TSearch indexes when the schema changes after CREATE TABLE // MySQL will need a different table type self::kill_temp_db(); @@ -29,7 +29,7 @@ class ZZZSearchFormTest extends FunctionalTest { parent::setUpOnce(); } - function setUp() { + public function setUp() { parent::setUp(); $holderPage = $this->objFromFixture('SiteTree', 'searchformholder'); @@ -38,7 +38,7 @@ class ZZZSearchFormTest extends FunctionalTest { $this->waitUntilIndexingFinished(); } - function testPublishedPagesMatchedByTitle() { + public function testPublishedPagesMatchedByTitle() { $sf = new SearchForm($this->mockController, 'SearchForm'); $publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage'); @@ -53,7 +53,7 @@ class ZZZSearchFormTest extends FunctionalTest { ); } - function testDoubleQuotesPublishedPagesMatchedByTitle() { + public function testDoubleQuotesPublishedPagesMatchedByTitle() { $sf = new SearchForm($this->mockController, 'SearchForm'); $publishedPage = $this->objFromFixture('SiteTree', 'publicPublishedPage'); @@ -71,7 +71,7 @@ class ZZZSearchFormTest extends FunctionalTest { } /* - function testUnpublishedPagesNotIncluded() { + public function testUnpublishedPagesNotIncluded() { $sf = new SearchForm($this->mockController, 'SearchForm'); $results = $sf->getResults(null, array('Search'=>'publicUnpublishedPage')); @@ -84,7 +84,7 @@ class ZZZSearchFormTest extends FunctionalTest { } */ - function testPagesRestrictedToLoggedinUsersNotIncluded() { + public function testPagesRestrictedToLoggedinUsersNotIncluded() { $sf = new SearchForm($this->mockController, 'SearchForm'); $page = $this->objFromFixture('SiteTree', 'restrictedViewLoggedInUsers'); @@ -106,7 +106,7 @@ class ZZZSearchFormTest extends FunctionalTest { $member->logOut(); } - function testPagesRestrictedToSpecificGroupNotIncluded() { + public function testPagesRestrictedToSpecificGroupNotIncluded() { $sf = new SearchForm($this->mockController, 'SearchForm'); $page = $this->objFromFixture('SiteTree', 'restrictedViewOnlyWebsiteUsers'); @@ -138,7 +138,7 @@ class ZZZSearchFormTest extends FunctionalTest { $member->logOut(); } - function testInheritedRestrictedPagesNotInlucded() { + public function testInheritedRestrictedPagesNotInlucded() { $sf = new SearchForm($this->mockController, 'SearchForm'); $page = $this->objFromFixture('SiteTree', 'inheritRestrictedView'); @@ -161,7 +161,7 @@ class ZZZSearchFormTest extends FunctionalTest { $member->logOut(); } - function testDisabledShowInSearchFlagNotIncludedForSiteTree() { + public function testDisabledShowInSearchFlagNotIncludedForSiteTree() { $sf = new SearchForm($this->mockController, 'SearchForm'); $page = $this->objFromFixture('SiteTree', 'dontShowInSearchPage'); @@ -173,7 +173,7 @@ class ZZZSearchFormTest extends FunctionalTest { ); } - function testDisabledShowInSearchFlagNotIncludedForFiles() { + public function testDisabledShowInSearchFlagNotIncludedForFiles() { $sf = new SearchForm($this->mockController, 'SearchForm'); $dontShowInSearchFile = $this->objFromFixture('File', 'dontShowInSearchFile'); @@ -193,7 +193,7 @@ class ZZZSearchFormTest extends FunctionalTest { ); } - function testSearchTitleAndContentWithSpecialCharacters() { + public function testSearchTitleAndContentWithSpecialCharacters() { $sf = new SearchForm($this->mockController, 'SearchForm'); $pageWithSpecialChars = $this->objFromFixture('SiteTree', 'pageWithSpecialChars'); diff --git a/tests/staticpublisher/FilesystemPublisherTest.php b/tests/staticpublisher/FilesystemPublisherTest.php index 5cb25c19..62005980 100644 --- a/tests/staticpublisher/FilesystemPublisherTest.php +++ b/tests/staticpublisher/FilesystemPublisherTest.php @@ -11,7 +11,7 @@ class FilesystemPublisherTest extends SapphireTest { protected $orig = array(); - function setUp() { + public function setUp() { parent::setUp(); Object::add_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')"); @@ -20,7 +20,7 @@ class FilesystemPublisherTest extends SapphireTest { FilesystemPublisher::$domain_based_caching = false; } - function tearDown() { + public function tearDown() { parent::tearDown(); Object::remove_extension("SiteTree", "FilesystemPublisher('assets/FilesystemPublisherTest-static-folder/')"); @@ -32,7 +32,7 @@ class FilesystemPublisherTest extends SapphireTest { } } - function testUrlsToPathsWithRelativeUrls() { + public function testUrlsToPathsWithRelativeUrls() { $fsp = new FilesystemPublisher('.', 'html'); $this->assertEquals( @@ -54,7 +54,7 @@ class FilesystemPublisherTest extends SapphireTest { ); } - function testUrlsToPathsWithAbsoluteUrls() { + public function testUrlsToPathsWithAbsoluteUrls() { $fsp = new FilesystemPublisher('.', 'html'); $url = Director::absoluteBaseUrl(); @@ -79,7 +79,7 @@ class FilesystemPublisherTest extends SapphireTest { ); } - function testUrlsToPathsWithDomainBasedCaching() { + public function testUrlsToPathsWithDomainBasedCaching() { $origDomainBasedCaching = FilesystemPublisher::$domain_based_caching; FilesystemPublisher::$domain_based_caching = true; @@ -120,7 +120,7 @@ class FilesystemPublisherTest extends SapphireTest { * is where extension instances are set up and subsequently used by * {@link DataObject::defineMethods()}. */ - function testHasCalledParentConstructor() { + public function testHasCalledParentConstructor() { $fsp = new FilesystemPublisher('.', '.html'); $this->assertEquals($fsp->class, 'FilesystemPublisher'); } @@ -129,7 +129,7 @@ class FilesystemPublisherTest extends SapphireTest { * These are a few simple tests to check that we will be retrieving the correct theme when we need it * StaticPublishing needs to be able to retrieve a non-null theme at the time publishPages() is called. */ - function testStaticPublisherTheme(){ + public function testStaticPublisherTheme(){ //This will be the name of the default theme of this particular project $default_theme=SSViewer::current_theme(); diff --git a/tests/tasks/RemoveOrphanedPagesTaskTest.php b/tests/tasks/RemoveOrphanedPagesTaskTest.php index 8f30c282..7b09b7f7 100644 --- a/tests/tasks/RemoveOrphanedPagesTaskTest.php +++ b/tests/tasks/RemoveOrphanedPagesTaskTest.php @@ -36,7 +36,7 @@ class RemoveOrphanedPagesTaskTest extends FunctionalTest { static $use_draft_site = false; - function setUp() { + public function setUp() { parent::setUp(); $parent1_published = $this->objFromFixture('Page', 'parent1_published'); @@ -75,7 +75,7 @@ class RemoveOrphanedPagesTaskTest extends FunctionalTest { $child2_1_published_orphaned->publish('Stage', 'Live'); } - function testGetOrphansByStage() { + public function testGetOrphansByStage() { // all orphans $child1_3_orphaned = $this->objFromFixture('Page', 'child1_3_orphaned'); $child1_4_orphaned_published = $this->objFromFixture('Page', 'child1_4_orphaned_published'); diff --git a/tests/travis/before_script b/tests/travis/before_script new file mode 100755 index 00000000..3c1c5928 --- /dev/null +++ b/tests/travis/before_script @@ -0,0 +1,10 @@ +BUILD_DIR=$1 +git clone --depth=100 --quiet git://github.com/silverstripe/silverstripe-installer.git $BUILD_DIR +git clone --depth=100 --quiet git://github.com/silverstripe-labs/silverstripe-sqlite3.git $BUILD_DIR/sqlite3 +git clone --depth=100 --quiet git://github.com/silverstripe/silverstripe-postgresql.git $BUILD_DIR/postgresql +git clone --depth=100 --quiet -b ${TRAVIS_BRANCH:-master} git://github.com/silverstripe/sapphire.git $BUILD_DIR/framework +cp $BUILD_DIR/framework/tests/travis/_ss_environment.php $BUILD_DIR +cp $BUILD_DIR/framework/tests/travis/_config.php $BUILD_DIR/mysite +cp -r . $BUILD_DIR/cms + +cd $BUILD_DIR diff --git a/thirdparty/multifile/multifile.js b/thirdparty/multifile/multifile.js index d73ef568..aae9d756 100644 --- a/thirdparty/multifile/multifile.js +++ b/thirdparty/multifile/multifile.js @@ -43,7 +43,7 @@ // Modified by: Silverstripe Ltd. (changed naming of file-input-elements) -function ObservableObject() { +public function ObservableObject() { this.functions = []; } ObservableObject.prototype = { @@ -63,7 +63,7 @@ ObservableObject.prototype = { var MultiSelectorObserver = new ObservableObject(); -function MultiSelector( list_target, max, upload_button ){ +public function MultiSelector( list_target, max, upload_button ){ this.upload_button = upload_button; this.upload_button.setAttribute("disabled", "disabled");