Skip to content
Permalink
Browse files

Adding tests for ArrayAccess for the EvenStack

  • Loading branch information...
burzum committed May 27, 2016
1 parent e71ce21 commit 390d7fb69e2aa9b31a58ad78cec4067d1623bee0
Showing with 29 additions and 0 deletions.
  1. +29 −0 tests/TestCase/Event/EventStackTest.php
@@ -46,4 +46,33 @@ public function testAddEventAndFlush()
$this->assertCount(0, $eventStack);
}
/**
* Testing implemented \ArrayAccess and \Count methods
*
* @return void
*/
public function testArrayAccess()
{
$eventStack = new EventStack();
$event = new Event('my_event', $this);
$event2 = new Event('my_second_event', $this);
$eventStack->add($event);
$eventStack->add($event2);
$this->assertCount(2, $eventStack);
$this->assertEquals($eventStack->offsetGet(0), $event);
$this->assertEquals($eventStack->offsetGet(1), $event2);
$this->assertTrue($eventStack->offsetExists(0));
$this->assertTrue($eventStack->offsetExists(1));
$this->assertFalse($eventStack->offsetExists(2));
$eventStack->offsetUnset(1);
$this->assertCount(1, $eventStack);
$eventStack->flush();
$this->assertCount(0, $eventStack);
}
}

0 comments on commit 390d7fb

Please sign in to comment.
You can’t perform that action at this time.