示例#1
0
 public function testWriterCanHandleSingleGroups()
 {
     $this->calc->add()->group(function (FluentCalculator $calc) {
         $calc->add(10);
     });
     $this->assertEquals('(10)', $this->getExpression());
 }
 public function testFunctionsCanAcceptClosuresWithFluentInstance()
 {
     $this->calculator->add()->abs(function (FluentCalculator $calc) {
         return $calc->set(10)->add(30)->multiply(-1);
     });
     $this->assertEquals(40, $this->calculator->get());
 }