1
0
mirror of synced 2024-12-14 07:06:04 +03:00
doctrine2/tests/Common/Collections/CollectionTest.php

45 lines
1.2 KiB
PHP

<?php
#namespace Doctrine\Tests\Common\Collections;
require_once 'lib/DoctrineTestInit.php';
/**
* Collection tests.
*
* @author robo
* @since 2.0
*/
class Common_Collections_CollectionTest extends Doctrine_TestCase {
private $_coll;
protected function setUp() {
$this->_coll = new Doctrine_Common_Collections_Collection;
}
/*public function testExists() {
$this->_coll->add("one");
$this->_coll->add("two");
$exists = $this->_coll->exists(function($key, $element) { return $element == "one"; });
$this->assertTrue($exists);
$exists = $this->_coll->exists(function($key, $element) { return $element == "other"; });
$this->assertFalse($exists);
}
public function testMap() {
$this->_coll->add(1);
$this->_coll->add(2);
$res = $this->_coll->map(function ($e) { return $e * 2; });
$this->assertEquals(array(2, 4), $res->unwrap());
}
public function testFilter() {
$this->_coll->add(1);
$this->_coll->add("foo");
$this->_coll->add(3);
$res = $this->_coll->filter(function ($e) { return is_numeric($e); });
$this->assertEquals(array(0 => 1, 2 => 3), $res->unwrap());
}*/
}