-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from chadicus/fea/immutable-keyvaluepair
Replace KeyValuePair with ImmutableKeyValuePair
- Loading branch information
Showing
4 changed files
with
54 additions
and
102 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,22 @@ | ||
<?php | ||
namespace Chadicus\Spl\DataStructures; | ||
|
||
/** | ||
* Defines a key/value pair interface. | ||
*/ | ||
interface KeyValuePairInterface | ||
{ | ||
/** | ||
* Gets the key in the key/value pair. | ||
* | ||
* @return mixed | ||
*/ | ||
public function getKey(); | ||
|
||
/** | ||
* Gets the value in the key/value pair. | ||
* | ||
* @return mixed | ||
*/ | ||
public function getValue(); | ||
} |
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,31 @@ | ||
<?php | ||
namespace ChadicusTest\Spl\DataStructures; | ||
|
||
use Chadicus\Spl\DataStructures\ImmutableKeyValuePair; | ||
|
||
/** | ||
* Unit tests for the \Chadicus\Spl\DataStructures\ImmutableKeyValuePair class. | ||
* | ||
* @coversDefaultClass \Chadicus\Spl\DataStructures\ImmutableKeyValuePair | ||
*/ | ||
final class ImmutableKeyValuePairTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* Verify basic behavior of ImmutableKeyValuePair class. | ||
* | ||
* @test | ||
* @covers ::__construct | ||
* @covers ::getValue | ||
* @covers ::getKey | ||
* | ||
* @return void | ||
*/ | ||
public function basicUsage() | ||
{ | ||
$key = new \StdClass(); | ||
$value = new \Exception(); | ||
$pair = new ImmutableKeyValuePair($key, $value); | ||
$this->assertSame($key, $pair->getKey()); | ||
$this->assertSame($value, $pair->getValue()); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.