public static function userViewPostWithPostCategoryIdEquals5AndWordCountGreaterThan100() { return new \PHPAccessControl\Situation\Situation(Aco::named('user'), new Action('view'), Aco::named('post')->with(aProperty::named('categoryId')->equals(5)->lAnd(aProperty::named('wordcount')->greaterThan(100)))); }
public function isGeneralizationOfAco(Aco $aco) { return $aco->isSpecialCaseOf($this); }
/** * @test */ public function anAcoIsASpecialCaseOfACompositeOrAco() { $postWithWordCountGt100 = Aco::named('post')->with(aProperty::named('wordcount')->greaterThan(100)); $postWithWordCountGt100AndCatId5 = Aco::named('post')->with(aProperty::named('wordcount')->greaterThan(100)->lOr(aProperty::named('categoryId')->equals(5))); $this->assertTrue($postWithWordCountGt100->isSpecialCaseOf($postWithWordCountGt100AndCatId5)); }