Make WordPress Core

Changeset 28480


Ignore:
Timestamp:
05/18/2014 09:14:13 PM (10 years ago)
Author:
wonderboymusic
Message:

Add a unit test that demonstrates a magic getter.

See #27881.

Location:
trunk/tests/phpunit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/functions.php

    r25002 r28480  
    4343}
    4444
     45class Basic_Object {
     46    private $foo = 'bar';
     47
     48    function __get( $name ) {
     49        return $this->$name;
     50    }
     51}
  • trunk/tests/phpunit/tests/basic.php

    r28064 r28480  
    11<?php
    2 
    32/**
    43 * just make sure the test framework is working
     
    123122        unset( $empty_array[$page]['bar']['baz'] );
    124123    }
     124
     125    function test_magic_getter() {
     126        $basic = new Basic_Object();
     127
     128        $this->assertEquals( 'bar', $basic->foo );
     129    }
    125130}
Note: See TracChangeset for help on using the changeset viewer.