cvs: ZendEngine2 /tests 024.phpt 025.phpt 026.phpt 027.phpt 028.phpt 029.phpt 030.phpt

[email protected] ("Felipe Pena")
Newsgroups php.zend-engine.cvs
Message-ID <cvsfelipe1208526886@cvsserver>
felipe		Fri Apr 18 13:54:46 2008 UTC

  Added files:                 
    /ZendEngine2/tests	024.phpt 025.phpt 026.phpt 027.phpt 028.phpt 
                      	029.phpt 030.phpt 
  Log:
  - New tests
  
  

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/024.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/024.phpt
+++ ZendEngine2/tests/024.phpt
--TEST--
Testing operations with undefined variable
--FILE--
<?php

var_dump($a[1]);
var_dump($a[$c]);
var_dump($a + 1);
var_dump($a + $b);
var_dump($a++);
var_dump(++$b);
var_dump($a->$b);
var_dump($a->$b);
var_dump($a->$b->$c[1]);

?>
--EXPECTF--
Notice: Undefined variable: a in %s on line %d
NULL

Notice: Undefined variable: c in %s on line %d

Notice: Undefined variable: a in %s on line %d
NULL

Notice: Undefined variable: a in %s on line %d
int(1)

Notice: Undefined variable: b in %s on line %d

Notice: Undefined variable: a in %s on line %d
int(0)

Notice: Undefined variable: a in %s on line %d
NULL

Notice: Undefined variable: b in %s on line %d
int(1)

Notice: Trying to get property of non-object in %s on line %d
NULL

Notice: Trying to get property of non-object in %s on line %d
NULL

Notice: Undefined variable: c in %s on line %d

Notice: Trying to get property of non-object in %s on line %d

Notice: Trying to get property of non-object in %s on line %d
NULL

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/025.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/025.phpt
+++ ZendEngine2/tests/025.phpt
--TEST--
Testing dynamic calls
--FILE--
<?php

class foo {
	static public function a() {
		print "ok\n";
	}
}

$a = 'a';
$b = 'a';

$class = 'foo';

foo::a();
foo::$a();
foo::$$b();

$class::a();
$class::$a();
$class::$$b();

?>
--EXPECT--
ok
ok
ok
ok
ok
ok

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/026.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/026.phpt
+++ ZendEngine2/tests/026.phpt
--TEST--
Trying assign value to property when an object is not returned in a function
--FILE--
<?php

class foo {
	public function a() {
	}
}

$test = new foo;

$test->a()->a;
print "ok\n";

$test->a()->a = 1;
print "ok\n";

?>
--EXPECTF--
Notice: Trying to get property of non-object in %s on line %d
ok

Strict Standards: Creating default object from empty value in %s on line %d
ok

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/027.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/027.phpt
+++ ZendEngine2/tests/027.phpt
--TEST--
Testing dynamic calls using variable variables with curly syntax
--FILE--
<?php

$a = 'b';
$b = 'c';
$c = 'strtoupper';

var_dump(${${$a}}('foo') == 'FOO');

$a = 'b';
$b = 'c';
$c = 'strtoupper';
$strtoupper = 'strtolower';

var_dump(${${++$a}}('FOO') == 'foo');

?>
--EXPECT--
bool(true)
bool(true)

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/028.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/028.phpt
+++ ZendEngine2/tests/028.phpt
--TEST--
Testing function call through of array item
--FILE--
<?php

$arr = array('strtoupper', 'strtolower');

$k = 0;

var_dump($arr[0]('foo') == 'FOO');
var_dump($arr[$k]('foo') == 'FOO');
var_dump($arr[++$k]('FOO') == 'foo');
var_dump($arr[++$k]('FOO') == 'foo');

?>
--EXPECTF--
bool(true)
bool(true)
bool(true)

Notice: Undefined offset: 2 in %s on line %d

Fatal error: Function name must be a string in %s on line %d

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/029.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/029.phpt
+++ ZendEngine2/tests/029.phpt
--TEST--
Testing assign to property of an object in an array
--FILE--
<?php

$arr = array(new stdClass);

$arr[0]->a = clone $arr[0];
var_dump($arr);

$arr[0]->b = new $arr[0];
var_dump($arr);

$arr[0]->c = $arr[0]->a;
var_dump($arr);

?>
--EXPECT--
array(1) {
  [0]=>
  object(stdClass)#1 (1) {
    ["a"]=>
    object(stdClass)#2 (0) {
    }
  }
}
array(1) {
  [0]=>
  object(stdClass)#1 (2) {
    ["a"]=>
    object(stdClass)#2 (0) {
    }
    ["b"]=>
    object(stdClass)#3 (0) {
    }
  }
}
array(1) {
  [0]=>
  object(stdClass)#1 (3) {
    ["a"]=>
    object(stdClass)#2 (0) {
    }
    ["b"]=>
    object(stdClass)#3 (0) {
    }
    ["c"]=>
    object(stdClass)#2 (0) {
    }
  }
}
--UEXPECT--
array(1) {
  [0]=>
  object(stdClass)#1 (1) {
    [u"a"]=>
    object(stdClass)#2 (0) {
    }
  }
}
array(1) {
  [0]=>
  object(stdClass)#1 (2) {
    [u"a"]=>
    object(stdClass)#2 (0) {
    }
    [u"b"]=>
    object(stdClass)#3 (0) {
    }
  }
}
array(1) {
  [0]=>
  object(stdClass)#1 (3) {
    [u"a"]=>
    object(stdClass)#2 (0) {
    }
    [u"b"]=>
    object(stdClass)#3 (0) {
    }
    [u"c"]=>
    object(stdClass)#2 (0) {
    }
  }
}

http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/030.phpt?view=markup&rev=1.1
Index: ZendEngine2/tests/030.phpt
+++ ZendEngine2/tests/030.phpt
--TEST--
Overriding $this in catch and checking the object properties later.
--FILE--
<?php

class foo {
	public $test = 0;
	private $test_2 = 1;
	protected $test_3 = 2;
	
	public function bar() {
		try {
			throw new Exception('foo');
		} catch (Exception $this) {
			var_dump($this);
		}

		$this->baz();		
	}
	
	public function baz() {
		foreach ($this as $k => $v) {
			printf("'%s' => '%s'\n", $k, $v);
		}		
		print "ok\n";
	}
}

$test = new foo;
$test->bar();

?>
--EXPECTF--
object(Exception)#2 (6) {
  ["message":protected]=>
  string(3) "foo"
  ["string":"Exception":private]=>
  string(0) ""
  ["code":protected]=>
  int(0)
  ["file":protected]=>
  string(%d) "%s"
  ["line":protected]=>
  int(%d)
  ["trace":"Exception":private]=>
  array(1) {
    [0]=>
    array(6) {
      ["file"]=>
      string(%d) "%s"
      ["line"]=>
      int(%d)
      ["function"]=>
      string(3) "bar"
      ["class"]=>
      string(3) "foo"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(0) {
      }
    }
  }
}
'test' => '0'
'test_2' => '1'
'test_3' => '2'
ok
--UEXPECTF--
object(Exception)#2 (6) {
  ["message":protected]=>
  string(3) "foo"
  ["string":"Exception":private]=>
  string(0) ""
  ["code":protected]=>
  int(0)
  ["file":protected]=>
  string(32) "%s"
  ["line":protected]=>
  int(%d)
  ["trace":"Exception":private]=>
  array(1) {
    [0]=>
    array(6) {
      ["file"]=>
      string(32) "%s"
      ["line"]=>
      int(%d)
      ["function"]=>
      string(3) "bar"
      ["class"]=>
      string(3) "foo"
      ["type"]=>
      string(2) "->"
      ["args"]=>
      array(0) {
      }
    }
  }
}
'test' => '0'
'test_2' => '1'
'test_3' => '2'
ok
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.