Skip to content

Commit

Permalink
add in tests for new set functionality.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashley Hutson authored and bryanjhv committed Nov 25, 2017
1 parent f9f26f8 commit a08c26c
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/HelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,35 @@ public function testSet()
$this->assertSame(['a' => 'A', 'b' => 'B', 'c' => 'C'], $_SESSION);
}

public function testAssocSet()
{
$helper = new Helper();

$helper->set('a', ['b' => 'B']);
$this->assertSame(['a' => ['b' => 'B']], $_SESSION);

$helper->b = ['c' => 'C'];
$this->assertSame(['a' => ['b' => 'B'], 'b' => ['c' => 'C']], $_SESSION);

$helper['c'] = ['d' => 'D'];
$this->assertSame(['a' => ['b' => 'B'], 'b' => ['c' => 'C'], 'c' => ['d' => 'D']], $_SESSION);
}

public function testMergeSet()
{
$helper = new Helper();
$helper->set('a', []);

$helper->set('a', ['a' => 'A']);
$this->assertSame(['a' => ['a' => 'A']], $_SESSION);

$helper->a = ['b' => 'B'];
$this->assertSame(['a' => ['a' => 'A', 'b' => 'B']], $_SESSION);

$helper['a'] = ['c' => 'C'];
$this->assertSame(['a' => ['a' => 'A', 'b' => 'B', 'c' => 'C']], $_SESSION);
}

public function testGet()
{
$helper = new Helper();
Expand Down

0 comments on commit a08c26c

Please sign in to comment.