FIX PR review fixes

* removed @package references
* included stubs in the test namespaces
* updated various return types
* updated composr psr4 autoload classes
* doc update
This commit is contained in:
Franco Springveldt 2017-09-08 15:59:53 +12:00
parent 7a3cc2e2ab
commit 1331a60fd7
18 changed files with 28 additions and 45 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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'

View File

@ -28,7 +28,6 @@ use SilverStripe\View\SSViewer;
* private static $allowed_actions = array('next','prev');
* </code>
*
* @package multiform
*/
abstract class MultiForm extends Form
{

View File

@ -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
{

View File

@ -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()
{

View File

@ -19,7 +19,6 @@ use SilverStripe\ORM\Queries\SQLSelect;
* in your WHERE clause:
* `<MyDataObjectClass>`.`MultiFormIsTemporary` = 1
*
* @package multiform
*/
class MultiFormObjectDecorator extends DataExtension
{

View File

@ -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;
}
/**

View File

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

View File

@ -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
{

View File

@ -1,4 +1,4 @@
SilverStripe\MultiForm\Tests\MultiFormObjectDecoratorDataObject:
SilverStripe\MultiForm\Tests\Stubs\MultiFormObjectDecoratorDataObject:
test-data-1:
Name: Test 1
MultiFormIsTemporary: 0

View File

@ -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
{

View File

@ -1,6 +1,6 @@
<?php
namespace SilverStripe\MultiForm\Tests;
namespace SilverStripe\MultiForm\Tests\Stubs;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;

View File

@ -1,6 +1,6 @@
<?php
namespace SilverStripe\MultiForm\Tests;
namespace SilverStripe\MultiForm\Tests\Stubs;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\EmailField;
@ -8,10 +8,6 @@ use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\MultiForm\Models\MultiFormStep;
/**
* @package multiform
* @subpackage tests
*/
class MultiFormTestStepOne extends MultiFormStep implements TestOnly
{
private static $next_steps = MultiFormTestStepTwo::class;

View File

@ -1,15 +1,11 @@
<?php
namespace SilverStripe\MultiForm\Tests;
namespace SilverStripe\MultiForm\Tests\Stubs;
use SilverStripe\Control\Controller;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\Dev\TestOnly;
/**
* @package multiform
* @subpackage tests
*/
class MultiFormTestController extends Controller implements TestOnly
{
private static $url_segment = 'MultiFormTestController';

View File

@ -1,14 +1,10 @@
<?php
namespace SilverStripe\MultiForm\Tests;
namespace SilverStripe\MultiForm\Tests\Stubs;
use SilverStripe\Dev\TestOnly;
use SilverStripe\MultiForm\Models\MultiForm;
/**
* @package multiform
* @subpackage tests
*/
class MultiFormTestForm extends MultiForm implements TestOnly
{
private static $start_step = MultiFormTestStepOne::class;

View File

@ -1,16 +1,12 @@
<?php
namespace SilverStripe\MultiForm\Tests;
namespace SilverStripe\MultiForm\Tests\Stubs;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextField;
use SilverStripe\MultiForm\Models\MultiFormStep;
/**
* @package multiform
* @subpackage tests
*/
class MultiFormTestStepThree extends MultiFormStep implements TestOnly
{
private static $is_final_step = true;

View File

@ -1,15 +1,11 @@
<?php
namespace SilverStripe\MultiForm\Tests;
namespace SilverStripe\MultiForm\Tests\Stubs;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Forms\FieldList;
use SilverStripe\Forms\TextareaField;
use SilverStripe\MultiForm\Models\MultiFormStep;
/**
* @package multiform
* @subpackage tests
*/
class MultiFormTestStepTwo extends MultiFormStep implements TestOnly
{
private static $next_steps = MultiFormTestStepThree::class;