first commit
This commit is contained in:
7
vendor/codeception/stub/tests/_data/DummyAbstractClass.php
vendored
Normal file
7
vendor/codeception/stub/tests/_data/DummyAbstractClass.php
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
abstract class DummyAbstractClass
|
||||
{
|
||||
}
|
||||
94
vendor/codeception/stub/tests/_data/DummyClass.php
vendored
Executable file
94
vendor/codeception/stub/tests/_data/DummyClass.php
vendored
Executable file
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
class DummyClass
|
||||
{
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
protected $checkMe = 1;
|
||||
|
||||
protected array $properties = ['checkMeToo' => 1];
|
||||
|
||||
function __construct($checkMe = 1)
|
||||
{
|
||||
$this->checkMe = 'constructed: '.$checkMe;
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
public function helloWorld()
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
public function goodByeWorld()
|
||||
{
|
||||
return 'good bye';
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
protected function notYourBusinessWorld()
|
||||
{
|
||||
return 'goAway';
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
public function getCheckMe()
|
||||
{
|
||||
return $this->checkMe;
|
||||
}
|
||||
|
||||
public function getCheckMeToo()
|
||||
{
|
||||
return $this->checkMeToo;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function call()
|
||||
{
|
||||
$this->targetMethod();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function targetMethod()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function exceptionalMethod()
|
||||
{
|
||||
throw new Exception('Catch it!');
|
||||
}
|
||||
|
||||
public function __set($name, $value)
|
||||
{
|
||||
if ($this->isMagical($name)) {
|
||||
$this->properties[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
if ($this->__isset($name)) {
|
||||
return $this->properties[$name];
|
||||
}
|
||||
}
|
||||
|
||||
public function __isset($name)
|
||||
{
|
||||
return $this->isMagical($name) && isset($this->properties[$name]);
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
private function isMagical($name)
|
||||
{
|
||||
$reflectionClass = new ReflectionClass($this);
|
||||
return !$reflectionClass->hasProperty($name);
|
||||
}
|
||||
}
|
||||
93
vendor/codeception/stub/tests/_data/DummyOverloadableClass.php
vendored
Normal file
93
vendor/codeception/stub/tests/_data/DummyOverloadableClass.php
vendored
Normal file
@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
class DummyOverloadableClass
|
||||
{
|
||||
/**
|
||||
* @var int|string
|
||||
*/
|
||||
protected $checkMe = 1;
|
||||
|
||||
protected array $properties = ['checkMeToo' => 1];
|
||||
|
||||
function __construct($checkMe = 1)
|
||||
{
|
||||
$this->checkMe = 'constructed: '.$checkMe;
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
public function helloWorld()
|
||||
{
|
||||
return 'hello';
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
public function goodByeWorld()
|
||||
{
|
||||
return 'good bye';
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
protected function notYourBusinessWorld()
|
||||
{
|
||||
return 'goAway';
|
||||
}
|
||||
|
||||
/** @return string */
|
||||
public function getCheckMe()
|
||||
{
|
||||
return $this->checkMe;
|
||||
}
|
||||
|
||||
public function getCheckMeToo()
|
||||
{
|
||||
return $this->checkMeToo;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function call()
|
||||
{
|
||||
$this->targetMethod();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
public function targetMethod()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public function exceptionalMethod()
|
||||
{
|
||||
throw new Exception('Catch it!');
|
||||
}
|
||||
|
||||
public function __get($name)
|
||||
{
|
||||
//seeing as we're not implementing __set here, add check for __mocked
|
||||
$return = null;
|
||||
if ($name === '__mocked') {
|
||||
$return = property_exists($this, '__mocked') && $this->__mocked !== null ? $this->__mocked : null;
|
||||
} elseif ($this->__isset($name)) {
|
||||
$return = $this->properties[$name];
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function __isset($name)
|
||||
{
|
||||
return $this->isMagical($name) && isset($this->properties[$name]);
|
||||
}
|
||||
|
||||
/** @return bool */
|
||||
private function isMagical($name)
|
||||
{
|
||||
$reflectionClass = new ReflectionClass($this);
|
||||
return !$reflectionClass->hasProperty($name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user