Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Set extension hook implementation visibility to protected #340

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Extensions/ArchiveRestoreAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ArchiveRestoreAction extends DataExtension
* @param Form $form
* @return mixed
*/
public function updateItemEditForm(Form $form)
protected function updateItemEditForm(Form $form)
{
$record = $this->owner->getRecord();

Expand Down
2 changes: 1 addition & 1 deletion src/Extensions/UsedOnTableExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class UsedOnTableExtension extends Extension
/**
* @var array $excludedClasses
*/
public function updateUsageExcludedClasses(array &$excludedClasses)
protected function updateUsageExcludedClasses(array &$excludedClasses)
{
$excludedClasses[] = ChangeSetItem::class;
}
Expand Down
9 changes: 8 additions & 1 deletion tests/Extensions/ArchiveRestoreActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use SilverStripe\Versioned\VersionedGridFieldItemRequest;
use SilverStripe\VersionedAdmin\ArchiveAdmin;
use SilverStripe\VersionedAdmin\Tests\Controllers\HistoryViewerControllerTest\ViewableVersionedObject;
use ReflectionMethod;
use SilverStripe\VersionedAdmin\Extensions\ArchiveRestoreAction;

class ArchiveRestoreActionTest extends SapphireTest
{
Expand Down Expand Up @@ -79,7 +81,12 @@ public function testUpdateItemEditForm()
'test'
);

$itemRequest->updateItemEditForm($form);
$ext = new ArchiveRestoreAction();
$method = new ReflectionMethod(ArchiveRestoreAction::class, 'updateItemEditForm');
$method->setAccessible(true);
$ext->setOwner($itemRequest);
$method->invokeArgs($ext, [$form]);

$actions = $form->Actions();
$this->assertInstanceOf(FormAction::class, $actions->fieldByName('action_doRestore'));
}
Expand Down
Loading