Skip to content

Instantly share code, notes, and snippets.

@flevour
Created February 28, 2011 14:56
Show Gist options
  • Save flevour/847420 to your computer and use it in GitHub Desktop.
Save flevour/847420 to your computer and use it in GitHub Desktop.
Testing 2 things with 2 test methods.
<?php
public function testIteratesOverOneElementArraysUsingValues()
{
$iterator = new ArrayIterator(array('foo'));
foreach ($iterator as $element) {
$this->assertEquals('foo', $element);
}
}
public function testIteratesOneTimeOverOneElementArrays()
{
$iterator = new ArrayIterator(array('foo'));
$i = 0;
foreach ($iterator as $element) {
$i++;
}
$this->assertEquals(1, $i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment