From a8f4f23c660474e965b510ba1bb04bf7a145d5b0 Mon Sep 17 00:00:00 2001 From: bergice Date: Tue, 27 Nov 2018 14:00:23 +1300 Subject: [PATCH 01/20] NEW: Add visibility updates to `upgrade.yml`. This will make the `inspect` upgrader command ensure these visibilities are used --- .upgrade.yml | 127 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) diff --git a/.upgrade.yml b/.upgrade.yml index 33d42e81e..5bd8f03d3 100644 --- a/.upgrade.yml +++ b/.upgrade.yml @@ -1367,3 +1367,130 @@ warnings: 'THIRDPARTY_DIR': message: 'Path constants have been deprecated. Use the Requirements and ModuleResourceLoader APIs' url: 'https://docs.silverstripe.org/en/4/changelogs/4.0.0#module-paths' +visibilities: + 'SilverStripe\ORM\DataObject::db': + visibility: private + 'SilverStripe\ORM\DataObject::singular_name': + visibility: private + 'SilverStripe\ORM\DataObject::plural_name': + visibility: private + 'SilverStripe\ORM\DataObject::api_access': + visibility: private + 'SilverStripe\ORM\DataObject::default_classname': + visibility: private + 'SilverStripe\ORM\DataObject->destroyed': + visibility: public + 'SilverStripe\ORM\DataObject->record': + visibility: protected + 'SilverStripe\ORM\DataObject->joinRecord': + visibility: protected + 'SilverStripe\ORM\DataObject->changed': + visibility: private + 'SilverStripe\ORM\DataObject->changeForced': + visibility: private + 'SilverStripe\ORM\DataObject->original': + visibility: protected + 'SilverStripe\ORM\DataObject->brokenOnDelete': + visibility: protected + 'SilverStripe\ORM\DataObject->brokenOnWrite': + visibility: protected + 'SilverStripe\ORM\DataObject::validation_enabled': + visibility: private + 'SilverStripe\ORM\DataObject::_cache_get_one': + visibility: protected + 'SilverStripe\ORM\DataObject::_cache_field_labels': + visibility: protected + 'SilverStripe\ORM\DataObject::fixed_fields': + visibility: private + 'SilverStripe\ORM\DataObject::table_name': + visibility: private + 'SilverStripe\ORM\DataObject->components': + visibility: protected + 'SilverStripe\ORM\DataObject->unsavedRelations': + visibility: protected + 'SilverStripe\ORM\DataObject::cascade_deletes': + visibility: private + 'SilverStripe\ORM\DataObject::cascade_duplicates': + visibility: private + 'SilverStripe\ORM\DataObject::sourceQueryParams': + visibility: private + 'SilverStripe\ORM\DataObject::subclass_access': + visibility: private + 'SilverStripe\ORM\DataObject::casting': + visibility: private + 'SilverStripe\ORM\DataObject::create_table_options': + visibility: private + 'SilverStripe\ORM\DataObject::indexes': + visibility: private + 'SilverStripe\ORM\DataObject::defaults': + visibility: private + 'SilverStripe\ORM\DataObject::default_records': + visibility: private + 'SilverStripe\ORM\DataObject::has_one': + visibility: private + 'SilverStripe\ORM\DataObject::belongs_to': + visibility: private + 'SilverStripe\ORM\DataObject::has_many': + visibility: private + 'SilverStripe\ORM\DataObject::many_many': + visibility: private + 'SilverStripe\ORM\DataObject::many_many_extraFields': + visibility: private + 'SilverStripe\ORM\DataObject::belongs_many_many': + visibility: private + 'SilverStripe\ORM\DataObject::default_sort': + visibility: private + 'SilverStripe\ORM\DataObject::searchable_fields': + visibility: private + 'SilverStripe\ORM\DataObject::field_labels': + visibility: private + 'SilverStripe\ORM\DataObject::summary_fields': + visibility: private + 'SilverStripe\Control\Director::rules': + visibility: private + 'SilverStripe\Control\Director::current_page': + visibility: private + 'SilverStripe\Control\Director::alternate_base_folder': + visibility: private + 'SilverStripe\Control\Director::alternate_public_dir': + visibility: private + 'SilverStripe\Control\Director::default_base_url': + visibility: private + 'SilverStripe\Forms\GridField\GridFieldPaginator::default_items_per_page': + visibility: private + 'SilverStripe\View\SSViewer::themes': + visibility: private + 'SilverStripe\View\SSViewer::current_themes': + visibility: protected + 'SilverStripe\View\SSViewer::theme': + visibility: private + 'SilverStripe\View\SSViewer::theme_enabled': + visibility: private + 'SilverStripe\View\SSViewer::global_key': + visibility: private + 'SilverStripe\View\SSViewer::source_file_comments': + visibility: private + 'SilverStripe\View\SSViewer::rewrite_hash_links': + visibility: private + 'SilverStripe\View\SSViewer::current_rewrite_hash_links': + visibility: protected + 'SilverStripe\View\SSViewer::rewriteHashlinks': + visibility: protected + 'SilverStripe\View\SSViewer::template_cache_flushed': + visibility: private + 'SilverStripe\View\SSViewer::cacheblock_cache_flushed': + visibility: private + 'SilverStripe\View\SSViewer::topLevel': + visibility: protected + 'SilverStripe\View\SSViewer::templates': + visibility: protected + 'SilverStripe\View\SSViewer::chosen': + visibility: protected + 'SilverStripe\View\SSViewer::subTemplates': + visibility: protected + 'SilverStripe\View\SSViewer::includeRequirements': + visibility: protected + 'SilverStripe\View\SSViewer::parser': + visibility: protected + 'SilverStripe\View\SSViewer::partialCacheStore': + visibility: protected From 34ac228029a4609d993e8604aad16e72bd52ac9c Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Fri, 11 Jan 2019 11:25:44 +1300 Subject: [PATCH 02/20] BUG Fix issue with assertListEquals() ignoring field getters --- src/Dev/Constraint/ViewableDataContains.php | 2 +- tests/php/Dev/ViewableDataContainsTest.php | 11 +++++++ .../ViewableDataContainsTest/TestObject.php | 31 +++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 tests/php/Dev/ViewableDataContainsTest/TestObject.php diff --git a/src/Dev/Constraint/ViewableDataContains.php b/src/Dev/Constraint/ViewableDataContains.php index c26084509..6665c0f46 100644 --- a/src/Dev/Constraint/ViewableDataContains.php +++ b/src/Dev/Constraint/ViewableDataContains.php @@ -64,7 +64,7 @@ class ViewableDataContains extends PHPUnit_Framework_Constraint implements TestO $success = true; foreach ($this->match as $fieldName => $value) { - if ($other->getField($fieldName) != $value) { + if ($other->$fieldName != $value) { $success = false; break; } diff --git a/tests/php/Dev/ViewableDataContainsTest.php b/tests/php/Dev/ViewableDataContainsTest.php index ad67051a8..fcf93c26e 100644 --- a/tests/php/Dev/ViewableDataContainsTest.php +++ b/tests/php/Dev/ViewableDataContainsTest.php @@ -4,6 +4,7 @@ namespace SilverStripe\Dev\Tests; use SilverStripe\Dev\Constraint\ViewableDataContains; use SilverStripe\Dev\SapphireTest; +use SilverStripe\Dev\Tests\ViewableDataContainsTest\TestObject; use SilverStripe\Security\Member; use SilverStripe\View\ArrayData; @@ -100,4 +101,14 @@ class ViewableDataContainsTest extends SapphireTest $this->assertFalse($constraint->evaluate($item, '', true)); } + + public function testFieldAccess() + { + $data = new TestObject(['name' => 'Damian']); + $constraint = new ViewableDataContains(['name' => 'Damian', 'Something' => 'something']); + $this->assertTrue($constraint->evaluate($data, '', true)); + + $constraint = new ViewableDataContains(['name' => 'Damian', 'Something' => 'notthing']); + $this->assertFalse($constraint->evaluate($data, '', true)); + } } diff --git a/tests/php/Dev/ViewableDataContainsTest/TestObject.php b/tests/php/Dev/ViewableDataContainsTest/TestObject.php new file mode 100644 index 000000000..0db24f3e4 --- /dev/null +++ b/tests/php/Dev/ViewableDataContainsTest/TestObject.php @@ -0,0 +1,31 @@ +data = $data; + } + + public function hasField($name) + { + return isset($this->data[$name]); + } + + public function getField($name) + { + return isset($this->data[$name]) ?: null; + } + + public function getSomething() + { + return 'something'; + } +} From d530bc2fb6c8c290f1f75f39bc4ec898cc326cf1 Mon Sep 17 00:00:00 2001 From: Benedikt Seidl Date: Thu, 24 Jan 2019 20:51:48 +0100 Subject: [PATCH 03/20] fix user feedback when jquery could not be loaded --- src/Dev/Install/Installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dev/Install/Installer.php b/src/Dev/Install/Installer.php index 742922f2f..f6bb7cc20 100644 --- a/src/Dev/Install/Installer.php +++ b/src/Dev/Install/Installer.php @@ -549,7 +549,7 @@ TEXT;
  • Testing...