Skip to content

Commit

Permalink
upgrade min laravel version from 5.5 to 6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
smajti1 committed Oct 24, 2019
1 parent 82a9a91 commit 1dd310a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 62 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor
composer.lock
/.idea
/.idea
.phpunit.result.cache
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

simple laravel step-by-step wizard

## Required

php ^7.0
laravel ^5.5
| Version | Laravel Version | Php Version |
|---- |----|----|
| 1.1 | 5.* | ^7.0 |
| 1.2 | 6.* | ^7.2 |

## Install

Expand Down
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"name": "smajti1/laravel-wizard",
"description": "Wizard component for laravel5.",
"keywords": ["laravel", "wizard"],
"keywords": ["laravel", "wizard", "step", "steps"],
"license": "MIT",
"authors": [
{
"name": "Hubert Dziubiński",
"email": "smajti1@gmail.com"
}
],
"homepage": "https://github.com/smajti1/laravel-wizard",
"require": {
"php": ">=7.0",
"illuminate/http": "~5.5"
"php": "^7.2",
"illuminate/http": "^6.0"
},
"require-dev": {
"phpunit/phpunit": "~6.0"
"phpunit/phpunit": "^8.0"
},
"autoload": {
"psr-4": {
Expand Down
29 changes: 6 additions & 23 deletions src/Wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ protected function createStepClass($stepClassName, int $naturalNumber, $key, int
return $step;
}

/**
* @return Step|null
*/
public function prevStep()
public function prevStep(): ?Step
{
if ($this->hasPrev()) {
return $this->get($this->currentIndex - 1);
Expand All @@ -59,7 +56,6 @@ public function hasPrev(): bool
}

/**
* @return Step
* @throws StepNotFoundException
*/
protected function get(int $index, bool $moveCurrentIndex = true): Step
Expand All @@ -73,10 +69,7 @@ protected function get(int $index, bool $moveCurrentIndex = true): Step
return $this->steps[$index];
}

/**
* @return null|string
*/
public function prevSlug()
public function prevSlug(): ?string
{
if ($this->hasPrev()) {
$prevSlug = $this->get($this->currentIndex - 1, false);
Expand All @@ -85,10 +78,7 @@ public function prevSlug()
return null;
}

/**
* @return Step|null
*/
public function nextStep()
public function nextStep(): ?Step
{
if ($this->hasNext()) {
return $this->get($this->currentIndex + 1);
Expand All @@ -106,10 +96,7 @@ public function limit(): int
return count($this->steps);
}

/**
* @return null|string
*/
public function nextSlug()
public function nextSlug(): ?string
{
if ($this->hasNext()) {
$nextStep = $this->get($this->currentIndex + 1, false);
Expand Down Expand Up @@ -149,17 +136,13 @@ public function firstOrLastProcessed(int $moveSteps = 0): Step

/**
* @deprecated
* @return bool|null
*/
public function lastProcessed()
public function lastProcessed(): ?bool
{
return $this->lastProcessedIndex();
}

/**
* @return int|null
*/
public function lastProcessedIndex()
public function lastProcessedIndex(): ?int
{
$data = $this->data();
if ($data) {
Expand Down
39 changes: 9 additions & 30 deletions tests/WizardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,17 @@ class WizardTest extends PHPUnit\Framework\TestCase
public function __construct()
{
parent::__construct();
$this->firstTestStepClass = $this->getMockBuilder(Step::class)
->disableOriginalConstructor()
->setMethods([
'process',
])
->getMock();
$this->firstTestStepClass = $this->createPartialMock(Step::class, ['process',]);
$this->firstTestStepClass::$label = 'First step label';
$this->firstTestStepClass::$slug = 'first-step';
$this->firstTestStepClass::$view = '';

$this->secondTestStepClass = $this->getMockBuilder(Step::class)
->disableOriginalConstructor()
->setMethods([
'process',
])
->getMock();
$this->secondTestStepClass = $this->createPartialMock(Step::class, ['process',]);
$this->secondTestStepClass::$label = 'Second step label';
$this->secondTestStepClass::$slug = 'second-step';
$this->secondTestStepClass::$view = '';

$this->thirdTestStepClass = $this->getMockBuilder(Step::class)
->disableOriginalConstructor()
->setMethods([
'process',
])
->getMock();
$this->thirdTestStepClass = $this->createPartialMock(Step::class, ['process',]);
$this->secondTestStepClass::$label = 'Third step label';
$this->secondTestStepClass::$slug = 'third-step';
$this->secondTestStepClass::$view = '';
Expand All @@ -57,10 +42,10 @@ public function __construct()
$this->wizardThirdStepKey => get_class($this->thirdTestStepClass),
];
$this->sessionKeyName = 'test';
$this->wizard = $this->getMockBuilder(Wizard::class)
->disableOriginalConstructor()
->setMethods(['createStepClass', 'lastProcessedIndex'])
->getMock();
$this->wizard = $this->createPartialMock(Wizard::class, [
'createStepClass',
'lastProcessedIndex',
]);

$this->wizard_reflection = new \ReflectionClass(Wizard::class);
}
Expand Down Expand Up @@ -168,10 +153,7 @@ public function testFirstOrLastProcessed()

public function testLastProcessedIndex()
{
$wizard = $this->getMockBuilder(Wizard::class)
->disableOriginalConstructor()
->setMethods(['data'])
->getMock();
$wizard = $this->createPartialMock(Wizard::class, ['data',]);
$wizard->expects($this->once())
->method('data')
->willReturn(['lastProcessed' => 1]);
Expand All @@ -180,10 +162,7 @@ public function testLastProcessedIndex()

public function testLastProcessedIndexWithoutData()
{
$wizard = $this->getMockBuilder(Wizard::class)
->disableOriginalConstructor()
->setMethods(['data'])
->getMock();
$wizard = $this->createPartialMock(Wizard::class, ['data',]);
$wizard->expects($this->once())
->method('data')
->willReturn([]);
Expand Down

0 comments on commit 1dd310a

Please sign in to comment.