-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add method to attach result at specific index
- Loading branch information
Showing
3 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Result; | ||
|
||
use Stratedge\Wye\Wye; | ||
|
||
class AttachAtIndexTest extends \Tests\TestCase | ||
{ | ||
public function testAppendsWithoutIndex() | ||
{ | ||
$result = Wye::makeResult()->attach(); | ||
$new_result = Wye::makeResult()->attachAtIndex(); | ||
|
||
$this->assertSame([$result, $new_result], Wye::getResults()); | ||
} | ||
|
||
public function testAddsResultAtIndex() | ||
{ | ||
$result = Wye::makeResult()->attach(); | ||
$new_result = Wye::makeResult()->attachAtIndex(3); | ||
|
||
$this->assertSame([0 => $result, 3 => $new_result], Wye::getResults()); | ||
} | ||
|
||
public function testOverwritesResultAtIndex() | ||
{ | ||
$result = Wye::makeResult()->attach(); | ||
$new_result = Wye::makeResult()->attachAtIndex(0); | ||
|
||
$this->assertSame([$new_result], Wye::getResults()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Result; | ||
|
||
use Stratedge\Wye\Wye; | ||
|
||
class AttachTest extends \Tests\TestCase | ||
{ | ||
public function testAppendsResult() | ||
{ | ||
$result = Wye::makeResult()->attach(); | ||
$new_result = Wye::makeResult()->attach(); | ||
|
||
$this->assertSame([$result, $new_result], Wye::getResults()); | ||
} | ||
} |