PHP Classes

File: tests/objectForeachTest.php

Recommend this page to a friend!
  Classes of Rick Hambrook  >  Nest  >  tests/objectForeachTest.php  >  Download  
File: tests/objectForeachTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test: object foreach
Class: Nest
Easily set and get values of nested arrays
Author: By
Last change: feat(meta): update namespaces and add composer file for composer/packagist support
Date: 6 years ago
Size: 671 bytes
 

Contents

Class file image Download
<?php

require_once(implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "src", "Nest.php"]));

use \
Hambrook\Nest\Nest as Nest;

/**
 * Tests for PHPUnit
 *
 * @author Rick Hambrook <rick@rickhambrook.com>
 * @copyright 2015 Rick Hambrook
 * @license https://www.gnu.org/licenses/gpl.txt GNU General Public License v3
 */
class objectForeachTest extends PHPUnit_Framework_TestCase {

    public function
testForeachIndexed() {
       
$Nest = new Nest(new testObjectForeachData);
       
$tmp = "";
        foreach (
$Nest as $t) {
           
$tmp .= $t;
        }
       
$this->assertEquals("abc", $tmp);
    }

}

class
testObjectForeachData {
    public
$one = "a";
    public
$two = "b";
    public
$three = "c";
}

For more information send a message to info at phpclasses dot org.