From 1331a60fd7a1f0dbd71755cdf7ddfd20983da032 Mon Sep 17 00:00:00 2001 From: Franco Springveldt Date: Fri, 8 Sep 2017 15:59:53 +1200 Subject: [PATCH] FIX PR review fixes * removed @package references * included stubs in the test namespaces * updated various return types * updated composr psr4 autoload classes * doc update --- README.md | 2 +- composer.json | 6 ++++-- lang/en.yml | 6 +++--- src/Models/MultiForm.php | 1 - src/Models/MultiFormSession.php | 1 - src/Models/MultiFormStep.php | 7 +++---- src/extensions/MultiFormObjectDecorator.php | 1 - src/tasks/MultiFormPurgeTask.php | 6 ++++-- templates/Includes/MultiFormProgressPercent.ss | 2 +- tests/MultiFormObjectDecoratorTest.php | 1 + tests/MultiFormObjectDecoratorTest.yml | 2 +- tests/MultiFormTest.php | 6 ++++-- tests/Stubs/MultiFormObjectDecoratorDataObject.php | 2 +- tests/Stubs/MultiFormStepOne.php | 6 +----- tests/Stubs/MultiFormTestController.php | 6 +----- tests/Stubs/MultiFormTestForm.php | 6 +----- tests/Stubs/MultiFormTestStepThree.php | 6 +----- tests/Stubs/MultiFormTestStepTwo.php | 6 +----- 18 files changed, 28 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 46d295e..c46e0d2 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Using [Composer](https://getcomposer.org/), you can install multiform into your SilverStripe site using this command (while in the directory where your site is currently located) -`composer require "silverstripe/multiform:*"` +```composer require "silverstripe/multiform:*"``` ### 2. Create subclass of MultiForm diff --git a/composer.json b/composer.json index 1e3a2ed..0b145df 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,6 @@ "phpunit/phpunit": "^5.7", "squizlabs/php_codesniffer": "^3.0" }, - "license": "BSD-3-Clause", "extra": { "branch-alias": { "dev-master": "2.x-dev" @@ -34,5 +33,8 @@ "SilverStripe\\MultiForm\\": "src/", "SilverStripe\\MultiForm\\Tests\\": "tests/" } - } + }, + "license": "BSD-3-Clause", + "minimum-stability": "dev", + "prefer-stable": true } diff --git a/lang/en.yml b/lang/en.yml index 5d8ffa9..a50a0d9 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -1,11 +1,11 @@ en: - MultiForm: + SilverStripe\MultiForm\MultiForm: BACK: Back NEXT: Next SUBMIT: Submit - MultiFormSession: + SilverStripe\MultiForm\MultiFormSession: PLURALNAME: 'Multi Form Sessions' SINGULARNAME: 'Multi Form Session' - MultiFormStep: + SilverStripe\MultiForm\MultiFormStep: PLURALNAME: 'Multi Form Steps' SINGULARNAME: 'Multi Form Step' diff --git a/src/Models/MultiForm.php b/src/Models/MultiForm.php index 2d9a81c..5882d25 100644 --- a/src/Models/MultiForm.php +++ b/src/Models/MultiForm.php @@ -28,7 +28,6 @@ use SilverStripe\View\SSViewer; * private static $allowed_actions = array('next','prev'); * * - * @package multiform */ abstract class MultiForm extends Form { diff --git a/src/Models/MultiFormSession.php b/src/Models/MultiFormSession.php index 39ecb45..7b92259 100644 --- a/src/Models/MultiFormSession.php +++ b/src/Models/MultiFormSession.php @@ -14,7 +14,6 @@ use SilverStripe\Security\Security; * the {@link MultiForm} and {@link MultiFormStep} classes * know what the current step is. * - * @package multiform */ class MultiFormSession extends DataObject { diff --git a/src/Models/MultiFormStep.php b/src/Models/MultiFormStep.php index 5962e20..493b3a0 100644 --- a/src/Models/MultiFormStep.php +++ b/src/Models/MultiFormStep.php @@ -15,7 +15,6 @@ use SilverStripe\ORM\DataObject; * in the process by knowing what it's next step is, and if applicable, it's previous * step. * - * @package multiform */ class MultiFormStep extends DataObject { @@ -142,7 +141,7 @@ class MultiFormStep extends DataObject */ public function getTitle() { - return $this->title ? $this->title : $this->class; + return $this->title ? $this->title : get_class($this); } /** @@ -272,7 +271,7 @@ class MultiFormStep extends DataObject * This will only return something if you've previously visited * the step ahead of the current step, and then gone back a step. * - * @return MultiFormStep|boolean + * @return MultiFormStep|boolean|void */ public function getNextStepFromDatabase() { @@ -305,7 +304,7 @@ class MultiFormStep extends DataObject * To determine if there is a previous step, we check the database to see if there's * a previous step for this multi form session ID. * - * @return string Classname of a {@link MultiFormStep} subclass + * @return string|void Classname of a {@link MultiFormStep} subclass */ public function getPreviousStep() { diff --git a/src/extensions/MultiFormObjectDecorator.php b/src/extensions/MultiFormObjectDecorator.php index 594a73b..ff9975f 100644 --- a/src/extensions/MultiFormObjectDecorator.php +++ b/src/extensions/MultiFormObjectDecorator.php @@ -19,7 +19,6 @@ use SilverStripe\ORM\Queries\SQLSelect; * in your WHERE clause: * ``.`MultiFormIsTemporary` = 1 * - * @package multiform */ class MultiFormObjectDecorator extends DataExtension { diff --git a/src/tasks/MultiFormPurgeTask.php b/src/tasks/MultiFormPurgeTask.php index 2765a05..6b2b359 100644 --- a/src/tasks/MultiFormPurgeTask.php +++ b/src/tasks/MultiFormPurgeTask.php @@ -17,7 +17,6 @@ use SilverStripe\ORM\DataObject; * or * `framework/sake MultiFormPurgeTask` * - * @package multiform */ class MultiFormPurgeTask extends BuildTask { @@ -29,6 +28,8 @@ class MultiFormPurgeTask extends BuildTask */ private static $session_expiry_days = 7; + private static $segment = 'MultiFormPurgeTask'; + /** * Run this cron task. * @@ -46,7 +47,8 @@ class MultiFormPurgeTask extends BuildTask $delCount++; } } - echo $delCount . ' session records deleted that were older than ' . $this->config()->get('session_expiry_days') . ' days.'; + echo $delCount . ' session records deleted that were older than ' + . $this->config()->get('session_expiry_days') . ' days.'. PHP_EOL; } /** diff --git a/templates/Includes/MultiFormProgressPercent.ss b/templates/Includes/MultiFormProgressPercent.ss index a1d919b..d47b1de 100644 --- a/templates/Includes/MultiFormProgressPercent.ss +++ b/templates/Includes/MultiFormProgressPercent.ss @@ -1 +1 @@ -

<%t MULTIFORM.ProgressPercent "You've completed {percent}% ({completedSteps}/{totalSteps})" percent=$CompletedPercent.Nice completedSteps=$CompletedStepCount totalSteps$TotalStepCount %>

+

<%t SilverStripe\\MultiForm\\MultiForm.ProgressPercent "You've completed {percent}% ({completedSteps}/{totalSteps})" percent=$CompletedPercent.Nice completedSteps=$CompletedStepCount totalSteps$TotalStepCount %>

diff --git a/tests/MultiFormObjectDecoratorTest.php b/tests/MultiFormObjectDecoratorTest.php index bbcbc28..9ef0137 100644 --- a/tests/MultiFormObjectDecoratorTest.php +++ b/tests/MultiFormObjectDecoratorTest.php @@ -4,6 +4,7 @@ namespace SilverStripe\MultiForm\Tests; use SilverStripe\Dev\SapphireTest; use SilverStripe\MultiForm\Extensions\MultiFormObjectDecorator; +use SilverStripe\MultiForm\Tests\Stubs\MultiFormObjectDecoratorDataObject; class MultiFormObjectDecoratorTest extends SapphireTest { diff --git a/tests/MultiFormObjectDecoratorTest.yml b/tests/MultiFormObjectDecoratorTest.yml index 1b4fca3..2ce3b5e 100644 --- a/tests/MultiFormObjectDecoratorTest.yml +++ b/tests/MultiFormObjectDecoratorTest.yml @@ -1,4 +1,4 @@ -SilverStripe\MultiForm\Tests\MultiFormObjectDecoratorDataObject: +SilverStripe\MultiForm\Tests\Stubs\MultiFormObjectDecoratorDataObject: test-data-1: Name: Test 1 MultiFormIsTemporary: 0 diff --git a/tests/MultiFormTest.php b/tests/MultiFormTest.php index 50b2476..d09d73e 100644 --- a/tests/MultiFormTest.php +++ b/tests/MultiFormTest.php @@ -9,6 +9,10 @@ use SilverStripe\Core\Injector\Injector; use SilverStripe\Dev\FunctionalTest; use SilverStripe\MultiForm\Models\MultiForm; use SilverStripe\MultiForm\Models\MultiFormSession; +use SilverStripe\MultiForm\Tests\Stubs\MultiFormTestController; +use SilverStripe\MultiForm\Tests\Stubs\MultiFormTestForm; +use SilverStripe\MultiForm\Tests\Stubs\MultiFormTestStepOne; +use SilverStripe\MultiForm\Tests\Stubs\MultiFormTestStepTwo; /** * MultiFormTest @@ -25,8 +29,6 @@ use SilverStripe\MultiForm\Models\MultiFormSession; * is a simulation of a page where MultiFormTest_Form is a simple * multi-step contact form it belongs to. * - * @package multiform - * @subpackage tests */ class MultiFormTest extends FunctionalTest { diff --git a/tests/Stubs/MultiFormObjectDecoratorDataObject.php b/tests/Stubs/MultiFormObjectDecoratorDataObject.php index 7b05c4d..45be595 100644 --- a/tests/Stubs/MultiFormObjectDecoratorDataObject.php +++ b/tests/Stubs/MultiFormObjectDecoratorDataObject.php @@ -1,6 +1,6 @@