Skip to content

Commit

Permalink
Added test for Dataholder class
Browse files Browse the repository at this point in the history
  • Loading branch information
maxalmonte14 committed Sep 26, 2018
1 parent d72dadf commit f94f6a2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Unit/DataHolderTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Tests\Unit;

use PHPUnit\Framework\TestCase;
use PHPCollections\DataHolder;

class DataHolderTest extends TestCase
{
private $dataHolder;

public function setUp()
{
$this->dataHolder = new DataHolder([
'name' => 'Max',
'age' => '24',
]);
}

/** @test */
public function it_can_add_elements()
{
$this->dataHolder->offsetSet('job', 'Programmer');
$this->assertEquals('Programmer', $this->dataHolder->offsetGet('job'));
}

/** @test */
public function it_can_remove_elements()
{
$this->dataHolder->offsetUnset('name');
$this->assertArrayNotHasKey('name', $this->dataHolder);
}
}

0 comments on commit f94f6a2

Please sign in to comment.