function setUp()
 {
     parent::setUp();
     $this->array = array('value1', 'value2', 'value3');
     $this->iterator = new ArrayIterator($this->array);
     $this->hash = array('k1' => 'val1', 'k2' => 'val2', 'k3' => 'val3');
     $this->hashIterator = new ArrayIterator($this->hash);
 }
 function setUp()
 {
     parent::setUp();
     $this->intArray = array(1 => 1, 2, "foo" => 3, 4);
     $this->intIterator = new ArrayIterator($this->intArray);
     $this->floatArray = array("foo" => 1.5, 1.1, 1);
     $this->floatIterator = new ArrayIterator($this->floatArray);
 }
示例#3
0
 function setUp()
 {
     parent::setUp(array('Functional\\drop_first', 'Functional\\drop_last'));
     $this->array = array('value1', 'value2', 'value3', 'value4');
     $this->iterator = new ArrayIterator($this->array);
     $this->hash = array('k1' => 'val1', 'k2' => 'val2', 'k3' => 'val3', 'k4' => 'val4');
     $this->hashIterator = new ArrayIterator($this->hash);
 }
 function setUp()
 {
     parent::setUp(array('Functional\\flat_map'));
     $this->array = array('v1', 'v2', 'v3');
     $this->iterator = new ArrayIterator($this->array);
     $this->hash = array('k1' => 'v1', 'k2' => 'v2', 'k3' => 'v3');
     $this->hashIterator = new ArrayIterator($this->hash);
 }
 function setUp()
 {
     parent::setUp(array('Functional\\first_index_of'));
     $this->array = array('value1', 'value', 'value', 'value2');
     $this->iterator = new ArrayIterator($this->array);
     $this->hash = array('k1' => 'val1', 'k2' => 'val2', 'k3' => 'val1', 'k4' => 'val3');
     $this->hashIterator = new ArrayIterator($this->hash);
 }
 function setUp()
 {
     parent::setUp($this->getAliases());
     $this->array = array('first', 'second', 'third');
     $this->iterator = new ArrayIterator($this->array);
     $this->badArray = array('foo', 'bar', 'baz');
     $this->badIterator = new ArrayIterator($this->badArray);
 }
 function setUp()
 {
     parent::setUp();
     $this->goodArray = array('value', 'value', 'value');
     $this->goodIterator = new ArrayIterator($this->goodArray);
     $this->badArray = array('value', 'nope', 'value');
     $this->badIterator = new ArrayIterator($this->badArray);
 }
示例#8
0
 function setUp()
 {
     parent::setUp();
     $this->intArray = array(1 => 1, 2, "foo" => 3);
     $this->intIterator = new ArrayIterator($this->intArray);
     $this->floatArray = array(1.1, 2.9, 3.5);
     $this->floatIterator = new ArrayIterator($this->floatArray);
 }
 function setUp()
 {
     parent::setUp();
     $this->array = array($this, $this, $this);
     $this->iterator = new ArrayIterator($this->array);
     $this->keyArray = array('k1' => $this, 'k2' => $this);
     $this->keyIterator = new ArrayIterator(array('k1' => $this, 'k2' => $this));
 }
示例#10
0
 function setUp()
 {
     parent::setUp();
     $this->array = array(1, 2, 3, 4);
     $this->iterator = new ArrayIterator($this->array);
     $this->badArray = array('foo', 'bar', 'baz');
     $this->badIterator = new ArrayIterator($this->badArray);
 }
示例#11
0
 function setUp()
 {
     parent::setUp();
     $this->array = array(1, "foo", 5.1, 5, "5.2", true, false, array(), new stdClass());
     $this->iterator = new ArrayIterator($this->array);
     $this->hash = array('k1' => 1, 'k2' => '5.2', 'k3' => 5, 'k4' => '5.1', 'k5' => 10.2, 'k6' => true, 'k7' => array(), 'k8' => new stdClass());
     $this->hashIterator = new ArrayIterator($this->hash);
 }
 function setUp()
 {
     parent::setUp();
     $this->array = array('value', 'wrong', 'value');
     $this->iterator = new ArrayIterator($this->array);
     $this->hash = array('k1' => 'value', 'k2' => 'wrong', 'k3' => 'value');
     $this->hashIterator = new ArrayIterator($this->hash);
 }
 function setUp()
 {
     parent::setUp();
     $this->cb = $this->getMockBuilder('cb')->setMethods(array('call'))->getMock();
     $this->array = array('value0', 'value1', 'value2', 'value3');
     $this->iterator = new ArrayIterator($this->array);
     $this->hash = array('k0' => 'value0', 'k1' => 'value1', 'k2' => 'value2');
     $this->hashIterator = new ArrayIterator($this->hash);
 }
示例#14
0
 function setUp()
 {
     parent::setUp();
     $this->goodArray = array(1, 2, 3, array(4, 5, 6, array(7, 8, 9)), 10, array(11, array(12, 13), 14), 15);
     $this->goodArray2 = array(1 => 1, "foo" => "2", 3 => "3", array("foo" => 5));
     $this->goodIterator = new ArrayIterator($this->goodArray);
     $this->goodIterator[3] = new ArrayIterator($this->goodIterator[3]);
     $this->goodIterator[5][1] = new ArrayIterator($this->goodIterator[5][1]);
 }
 function setUp()
 {
     parent::setUp(array('Functional\\invoke_first'));
     $this->array = array($this, null, null);
     $this->iterator = new ArrayIterator($this->array);
     $this->keyArray = array('k1' => $this, 'k2' => null);
     $this->keyIterator = new ArrayIterator(array('k1' => $this, 'k2' => null));
     $this->arrayVeryFirstNotCallable = array(null, $this, null, null);
     $this->iteratorVeryFirstNotCallable = new ArrayIterator($this->arrayVeryFirstNotCallable);
 }
 function setUp()
 {
     parent::setUp();
     $this->array = array('value1', 'value2', 'value1', 'value');
     $this->iterator = new ArrayIterator($this->array);
     $this->mixedTypesArray = array(1, '1', '2', 2, '3', 4);
     $this->mixedTypesIterator = new ArrayIterator($this->mixedTypesArray);
     $this->hash = array('k1' => 'val1', 'k2' => 'val2', 'k3' => 'val2', 'k1' => 'val1');
     $this->hashIterator = new ArrayIterator($this->hash);
 }
示例#17
0
 function setUp()
 {
     parent::setUp();
     $this->trueArray = array(true, true, true, true);
     $this->trueIterator = new ArrayIterator($this->trueArray);
     $this->trueHash = array('k1' => true, 'k2' => true, 'k3' => true);
     $this->trueHashIterator = new ArrayIterator($this->trueHash);
     $this->falseArray = array(true, 1, true);
     $this->falseIterator = new ArrayIterator($this->falseArray);
     $this->falseHash = array('k1' => true, 'k2' => 1, 'k3' => true);
     $this->falseHashIterator = new ArrayIterator($this->falseHash);
 }
 function setUp()
 {
     parent::setUp();
     $this->trueArray = array(false, false, false, false);
     $this->trueIterator = new ArrayIterator($this->trueArray);
     $this->trueHash = array('k1' => false, 'k2' => false, 'k3' => false);
     $this->trueHashIterator = new ArrayIterator($this->trueHash);
     $this->falseArray = array(false, 0, false, 'foo', array(), (object) array());
     $this->falseIterator = new ArrayIterator($this->falseArray);
     $this->falseHash = array('k1' => false, 'k2' => 0, 'k3' => false);
     $this->falseHashIterator = new ArrayIterator($this->falseHash);
 }
 function setUp()
 {
     parent::setUp();
     $this->array = array('cat', 'bear', 'aardvark');
     $this->iterator = new ArrayIterator($this->array);
     $this->hash = array('c' => 'cat', 'b' => 'bear', 'a' => 'aardvark');
     $this->hashIterator = new ArrayIterator($this->hash);
     $this->sortCallback = function ($left, $right, $collection) {
         Exceptions\InvalidArgumentException::assertCollection($collection, __FUNCTION__, 3);
         return strcmp($left, $right);
     };
 }
 function setUp()
 {
     parent::setUp();
     $this->trueArray = array(false, null, false, false, 0);
     $this->trueIterator = new ArrayIterator($this->trueArray);
     $this->trueHash = array('k1' => false, 'k2' => null, 'k3' => false, 'k4' => 0);
     $this->trueHashIterator = new ArrayIterator($this->trueHash);
     $this->falseArray = array(false, null, 0, 'foo');
     $this->falseIterator = new ArrayIterator($this->falseArray);
     $this->falseHash = array('k1' => false, 'k2' => 0, 'k3' => true, 'k4' => null);
     $this->falseHashIterator = new ArrayIterator($this->falseHash);
 }
示例#21
0
 function setUp()
 {
     parent::setUp();
     $this->hash = array("f0" => 12, "f1" => 2, "f3" => true, "f4" => false, "f5" => "str", "f6" => array(), "f7" => new stdClass(), "f8" => 1);
     $this->hashIterator = new ArrayIterator($this->hash);
     $this->array = array_values($this->hash);
     $this->arrayIterator = new ArrayIterator($this->array);
     $this->hash2 = array("f0" => 1.0, "f1" => 0.5, "f3" => true, "f4" => false, "f5" => 1);
     $this->hashIterator2 = new ArrayIterator($this->hash2);
     $this->array2 = array_values($this->hash2);
     $this->arrayIterator2 = new ArrayIterator($this->array2);
     $this->hash3 = array("f0" => array(), "f1" => new stdClass(), "f2" => null, "f3" => "foo");
     $this->hashIterator3 = new ArrayIterator($this->hash3);
     $this->array3 = array_values($this->hash3);
     $this->arrayIterator3 = new ArrayIterator($this->array3);
 }
示例#22
0
 function setUp()
 {
     parent::setUp();
     $this->callback = $this->getMockBuilder('stdClass')->setMethods(array('execute'))->getMock();
     self::$invocation = 0;
 }
 function setUp()
 {
     parent::setUp(array('Functional\\invoke_if'));
 }
示例#24
0
 function setUp()
 {
     parent::setUp();
     $this->propertyExistsEverywhereArray = array((object) array('property' => 1), (object) array('property' => 2));
     $this->propertyExistsEverywhereIterator = new ArrayIterator($this->propertyExistsEverywhereArray);
     $this->propertyExistsSomewhere = array((object) array('property' => 1), (object) array('otherProperty' => 2));
     $this->propertyMagicGet = array(new MagicGet(array('property' => 1)), new MagicGet(array('property' => 2)), array('property' => '3'), new ArrayObject(array('property' => 4)));
     $this->mixedCollection = array((object) array('property' => 1), array('key' => 'value'), array('property' => 2));
     $this->keyedCollection = array('test' => (object) array('property' => 1), 'test2' => (object) array('property' => 2));
     $fixedArray = new SplFixedArray(1);
     $fixedArray[0] = 3;
     $this->numericArrayCollection = array('one' => array(1), 'two' => array(1 => 2), 'three' => array('idx' => 2), 'four' => new ArrayObject(array(2)), 'five' => $fixedArray);
     $this->issetExceptionArray = array((object) array('property' => 1), new MagicGetException(true, false));
     $this->issetExceptionIterator = new ArrayIterator($this->issetExceptionArray);
     $this->getExceptionArray = array((object) array('property' => 1), new MagicGetException(false, true));
     $this->getExceptionIterator = new ArrayIterator($this->getExceptionArray);
 }
示例#25
0
 function setUp()
 {
     parent::setUp(array('Functional\\reduce_right', 'Functional\\reduce_left'));
     $this->array = array('one', 'two', 'three');
     $this->iterator = new ArrayIterator($this->array);
 }