<?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();
/** * 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; }
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; }
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>"; ?>
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(); ?>
/** * Add child test * @param Test $test * @return TreeTest */ public function addChildTest(Test $test) : TreeTest { $this->childTests[$test->getName()] = $test; return $this; }