2016-07-27 23:27:28 +02:00
|
|
|
<?php
|
2016-08-21 00:19:18 +02:00
|
|
|
include_once 'tests/__lib__/Mock.php';
|
2016-07-27 23:27:28 +02:00
|
|
|
|
2016-08-21 00:19:18 +02:00
|
|
|
class BeanMock extends \Mock implements ArrayAccess {
|
2016-07-27 23:27:28 +02:00
|
|
|
private $properties;
|
|
|
|
|
|
|
|
public function __construct($array = []) {
|
|
|
|
$this->properties = $array;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function offsetSet($offset, $value) {
|
|
|
|
$this->__set($offset, $value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function offsetExists($offset) {
|
|
|
|
return $this->__isset($offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function offsetUnset($offset) {
|
|
|
|
$this->__unset($offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function &offsetGet($offset) {
|
|
|
|
return $this->__get($offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function &__get($property) {
|
|
|
|
return $this->properties[$property];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __set($property, $value) {
|
|
|
|
$this->properties[$property] = $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __isset($property) {
|
|
|
|
return isset($this->properties[$property]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function __unset($property) {
|
|
|
|
unset($this->properties[$property]);
|
|
|
|
}
|
|
|
|
}
|