Tester\Assert::throws PHP Method

throws() public static method

Checks if the function throws exception, alias for exception().
public static throws ( callable $function, $class, $message = NULL, $code = NULL ) : Exception
$function callable
return Exception
    public static function throws(callable $function, $class, $message = NULL, $code = NULL)
    {
        return self::exception($function, $class, $message, $code);
    }

Usage Example

 public function testCallback()
 {
     $form = new Form();
     $sug = $form->addSuggestion('suggestion')->setCallback(array($this, 'suggestionCallback'));
     $this->assertSame(array('query1', 'query2'), $sug->call('query'));
     A::throws(function () use($sug) {
         $sug->getControl();
     }, 'Nette\\InvalidStateException');
     $this->assertInstanceOf('Nette\\Utils\\Html', $sug->getControl(FALSE));
     $sug->setLink('link');
     $this->assertInstanceOf('Nette\\Utils\\Html', $sug->getControl());
 }
All Usage Examples Of Tester\Assert::throws