Exemplo n.º 1
0
<?php

include './GettersAndSetters.php';
class Test extends GettersAndSetters
{
    /**
     * @method String getName() return the value of attribute name
     * @method $this setName($value) set the value in attribute name
     */
    protected $name;
    /**
     * @method String getNameWithUnderscore() return the value of attribute name
     * @method $this setNameWithUnderscore($value) set the value in attribute name
     */
    protected $_nameWithUnderscore;
}
$test = new Test();
$test->setName("Name");
$test->setNameWithUnderscore("Name");
echo $test->getName();
echo "<br>";
echo $test->getNameWithUnderscore();
Exemplo n.º 2
0
 /**
  * Check if input test is active
  *
  * @param Test $test
  * @param Suite $suite
  * @return boolean
  */
 public function isValid(Test $test, Suite $suite)
 {
     return $this->isActive() ? $this->name && $test->getName() === $this->name || $this->type && $test->getType() === $this->type || $this->group && $suite->getCurrentGroupName() === $this->group : true;
 }
Exemplo n.º 3
0
 public function __construct(Test $test, $code = null, \Exception $previous = null)
 {
     $message = sprintf('"%s" test is skipped.', $test->getName());
     parent::__construct($message, $code, $previous);
     $this->test = $test;
 }
Exemplo n.º 4
0
echo "<BR>";
$y = testScope();
echo "x is " . $x;
echo "<BR>";
echo "y is " . $y;
echo "<BR>";
echo "<hr><br>";
// OBJECTS
class Test
{
    const A_BIG_NUMBER = 11111;
    private $name;
    static $i = 0;
    function __construct($name)
    {
        $this->name = $name;
        self::$i += 1;
    }
    public function getName()
    {
        return $this->name . " " . self::A_BIG_NUMBER;
    }
}
$myObj = new Test("Timothy");
echo $myObj->getName();
echo "<br>";
// We will do objects again later.
echo "<hr><br>";
?>

Exemplo n.º 5
0
	public function getHeight()
	{
		echo  $this->height;
	}

	public function getName()
	{
		echo $this->name;
	}
}

$test = new Test();	

try {
	$test->full_name	 = "Akash Sinha";
} catch (Exception $e) {
	echo $e->getMessage();
}

try {
	echo $test->__get("height") . "<br />";
} catch (Exception $e) {
	echo $e->getMessage();
}

$test->getName() . "<br />";

$test->getHeight();


 ?>
Exemplo n.º 6
0
 /**
  * Add child test
  * @param Test $test
  * @return TreeTest
  */
 public function addChildTest(Test $test) : TreeTest
 {
     $this->childTests[$test->getName()] = $test;
     return $this;
 }