コード例 #1
0
 /**
  * @test
  */
 public function itShouldReturnAnInvalidCallbackExceptionIfFailCallbackIsProvidedAndIsNotCallable()
 {
     $this->setExpectedException('subzeta\\Ruling\\Exception\\InvalidCallbackException', 'Fail callback must be callable.');
     $this->ruling->given(['heyyo' => true])->when('2 > 3')->then(function () {
         return null;
     })->otherwise('morcilla')->execute();
 }
コード例 #2
0
 /**
  * @dataProvider getData
  * @param array $context
  * @param string|string[] $rules
  * @param bool $expectation
  * @test
  */
 public function itShouldReturnTheExpectedCallback($context, $rules, $expectation)
 {
     $this->assertSame($expectation, $this->ruling->given($context)->when($rules)->execute());
 }