public function testLogicalOperatorGeneration() { $rb = new RuleBuilder(); $context = new Context(); $true = new TrueProposition(); $false = new FalseProposition(); $this->assertInstanceOf('Ruler\\Operator\\LogicalAnd', $rb->logicalAnd($true, $false)); $this->assertFalse($rb->logicalAnd($true, $false)->evaluate($context)); $this->assertInstanceOf('Ruler\\Operator\\LogicalOr', $rb->logicalOr($true, $false)); $this->assertTrue($rb->logicalOr($true, $false)->evaluate($context)); $this->assertInstanceOf('Ruler\\Operator\\LogicalNot', $rb->logicalNot($true)); $this->assertFalse($rb->logicalNot($true)->evaluate($context)); $this->assertInstanceOf('Ruler\\Operator\\LogicalXor', $rb->logicalXor($true, $false)); $this->assertTrue($rb->logicalXor($true, $false)->evaluate($context)); }
/** * @dataProvider truthTableOne */ public function testExcludedMiddle($p) { $rb = new RuleBuilder(); $context = new Context(compact('p')); $this->assertEquals($rb->create($rb->logicalOr($rb['p']->equalTo(true), $rb->logicalNot($rb['p']->equalTo(true))))->evaluate($context), true); }