Skip to content

Commit

Permalink
Merge branch '4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
whatthejeff committed Mar 5, 2014
2 parents e25984f + 46b30b0 commit dcd869a
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 40 deletions.
55 changes: 15 additions & 40 deletions Tests/Framework/Constraint/CountTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,46 +43,21 @@
* @since File available since Release 3.7.30
*/

require_once __DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'TestIterator.php';

class TestIterator2 implements Iterator {

protected $data;

public function __construct(array $array)
{
$this->data = $array;
}

public function current()
{
return current($this->data);
}

public function next()
{
next($this->data);
}

public function key()
{
return key($this->data);
}

public function valid()
{
return key($this->data) !== null;
}

public function rewind()
/**
*
*
* @package PHPUnit
* @author Sebastian Bergmann <[email protected]>
* @author Jeroen Versteeg <[email protected]>
* @copyright 2001-2014 Sebastian Bergmann <[email protected]>
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
* @link http://www.phpunit.de/
* @since Class available since Release 3.7.30
*/
class CountTest extends PHPUnit_Framework_TestCase
{
public function testCount()
{
reset($this->data);
}
}

class CountTest extends PHPUnit_Framework_TestCase {

public function test_Count() {
$countConstraint = new PHPUnit_Framework_Constraint_Count(3);
$this->assertTrue($countConstraint->evaluate(array(1,2,3), '', true));

Expand All @@ -94,7 +69,7 @@ public function test_Count() {
$this->assertTrue($countConstraint->evaluate($it, '', true));
}

public function test_CountDoesNotChangeIteratorKey ()
public function testCountDoesNotChangeIteratorKey()
{
$countConstraint = new PHPUnit_Framework_Constraint_Count(2);

Expand Down
35 changes: 35 additions & 0 deletions Tests/_files/TestIterator2.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
class TestIterator2 implements Iterator {

protected $data;

public function __construct(array $array)
{
$this->data = $array;
}

public function current()
{
return current($this->data);
}

public function next()
{
next($this->data);
}

public function key()
{
return key($this->data);
}

public function valid()
{
return key($this->data) !== null;
}

public function rewind()
{
reset($this->data);
}
}
1 change: 1 addition & 0 deletions tests/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ function($class) {
'testclass' => '/Framework/ComparatorTest.php',
'testclasscomparator' => '/Framework/ComparatorTest.php',
'testiterator' => '/_files/TestIterator.php',
'testiterator2' => '/_files/TestIterator2.php',
'throwexceptiontestcase' => '/_files/ThrowExceptionTestCase.php',
'thrownoexceptiontestcase' => '/_files/ThrowNoExceptionTestCase.php',
'twotest' => '/Regression/783/TwoTest.php',
Expand Down

0 comments on commit dcd869a

Please sign in to comment.