Esempio n. 1
0
         $exception = $e;
     }
     assert(!is_null($exception), 'exception should not be null');
 });
 context("and the desired property is on a child scope's child", function () {
     it("should look up property on the child scope's child", function () {
         $testScope = new TestScope();
         $testScope->peridotAddChildScope(new TestChildScope());
         $this->scope->peridotAddChildScope($testScope);
         $surname = $this->scope->surname;
         assert($surname === "scaturro", "expected scope to look up child scope's child property");
     });
     context("when mixing in multiple scopes, one of which has a child", function () {
         it("should look up the child scope on the sibling", function () {
             $testScope = new TestScope();
             $testSibling = new TestSiblingScope();
             $testChild = new TestChildScope();
             $testSibling->peridotAddChildScope($testChild);
             $this->scope->peridotAddChildScope($testScope);
             $this->scope->peridotAddChildScope($testSibling);
             $name = $this->scope->name;
             $middle = $this->scope->middleName;
             $surname = $this->scope->surname;
             assert($name === "brian", "expected result of TestScope::name");
             assert($middle == "zooooom", "expected result of TestSiblingScope::middleName");
             assert($surname === "scaturro", "expected result of TestChildScope::surname");
         });
     });
 });
 context("when mixing in multiple scopes", function () {
     it("should look up properties for sibling scopes", function () {
Esempio n. 2
0
         $parent->mixin($child);
         assert($child->parentProperty === 'value', 'expected child to be able to look at parent scope');
     });
 });
 context("and the desired property is on a child scope's child", function () {
     it("should look up property on the child scope's child", function () {
         $testScope = new TestScope();
         $testScope->mixin(new TestChildScope());
         $this->scope->mixin($testScope);
         $surname = $this->scope->surname;
         assert($surname === "scaturro", "expected scope to look up child scope's child property");
     });
     context("when mixing in multiple scopes, one of which has a child", function () {
         it("should look up the child scope on the sibling", function () {
             $testScope = new TestScope();
             $testSibling = new TestSiblingScope();
             $testChild = new TestChildScope();
             $testSibling->mixin($testChild);
             $this->scope->mixin($testScope);
             $this->scope->mixin($testSibling);
             $name = $this->scope->name;
             $middle = $this->scope->middleName;
             $surname = $this->scope->surname;
             assert($name === "brian", "expected result of TestScope::name");
             assert($middle == "zooooom", "expected result of TestSiblingScope::middleName");
             assert($surname === "scaturro", "expected result of TestChildScope::surname");
         });
     });
 });
 context("when mixing in multiple scopes", function () {
     it("should look up properties for sibling scopes", function () {