True errors
This commit is contained in:
parent
dbc40b821d
commit
af35aab345
@ -22,14 +22,7 @@ abstract class AbstractConnectionDecorator implements ConnectionInterface {
|
||||
$this->wrappedConn->$name = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @todo trigger_error() instead - Have it the same as if called from a POPO
|
||||
*/
|
||||
public function __get($name) {
|
||||
if (!$this->__isset($name)) {
|
||||
throw new \InvalidArgumentException("Attribute '{$name}' not found in Connection {$this->getID()}");
|
||||
}
|
||||
|
||||
return $this->wrappedConn->$name;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,45 @@ class AbstractConnectionDecoratorTest extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertSame($this->l1, $conn);
|
||||
}
|
||||
|
||||
public function testWrapperCanStoreSelfInDecorator() {
|
||||
$this->mock->decorator = $this->l1;
|
||||
|
||||
$this->assertSame($this->l1, $this->l2->decorator);
|
||||
}
|
||||
|
||||
public function testDecoratorRecursion() {
|
||||
$this->mock->decorator = new \stdClass;
|
||||
$this->mock->decorator->conn = $this->l1;
|
||||
|
||||
$this->assertSame($this->l1, $this->mock->decorator->conn);
|
||||
$this->assertSame($this->l1, $this->l1->decorator->conn);
|
||||
$this->assertSame($this->l1, $this->l2->decorator->conn);
|
||||
}
|
||||
|
||||
public function testDecoratorRecursionLevel2() {
|
||||
$this->mock->decorator = new \stdClass;
|
||||
$this->mock->decorator->conn = $this->l2;
|
||||
|
||||
$this->assertSame($this->l2, $this->mock->decorator->conn);
|
||||
$this->assertSame($this->l2, $this->l1->decorator->conn);
|
||||
$this->assertSame($this->l2, $this->l2->decorator->conn);
|
||||
|
||||
// just for fun
|
||||
$this->assertSame($this->l2, $this->l2->decorator->conn->decorator->conn->decorator->conn);
|
||||
}
|
||||
|
||||
public function testWarningGettingNothing() {
|
||||
$this->markTestSkipped('Functionality not in class yet');
|
||||
$this->setExpectedException('PHPUnit_Framework_Error');
|
||||
$var = $this->mock->nonExistant;
|
||||
}
|
||||
|
||||
public function testWarningGettingNothingLevel1() {
|
||||
$this->setExpectedException('PHPUnit_Framework_Error');
|
||||
$var = $this->l1->nonExistant;
|
||||
}
|
||||
|
||||
public function testWarningGettingNothingLevel2() {
|
||||
$this->setExpectedException('PHPUnit_Framework_Error');
|
||||
$var = $this->l2->nonExistant;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user