PHP Classes

File: tests/magicPrefixTest.php

Recommend this page to a friend!
  Classes of Rick Hambrook  >  Nest  >  tests/magicPrefixTest.php  >  Download  
File: tests/magicPrefixTest.php
Role: Unit test script
Content type: text/plain
Description: Unit test: magic prefix
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: 768 bytes


Class file image Download

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

use \
Hambrook\Nest\Nest as Nest;

 * Tests for PHPUnit
 * @author Rick Hambrook <>
 * @copyright 2015 Rick Hambrook
 * @license GNU General Public License v3
class magicPrefixTest extends PHPUnit_Framework_TestCase {

    public function
testSetMagic() {
$Nest = new Nest([]);
// Valid, 1 level)
$Nest->__data = "bar";
$this->assertEquals("bar", $Nest->__data);
$this->assertEquals("bar", $Nest->data);

    public function
testSetNestedMagic() {
$Nest = new Nest([]);
// Invalid, 1 level
$Nest->__plus__minus = "four";
$this->assertEquals("four", $Nest->__plus__minus);


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