4require_once(
"libs/composer/vendor/autoload.php");
 
   13        return $this->getLngClosure();
 
   41        $is_ok = 
function ($value) {
 
   44        $this->txt_id = 
"TXT_ID";
 
   45        $error = 
function (callable 
$txt, $value) use ($txt_id) {
 
   46            return $txt($txt_id, $value);
 
   48        $this->lng = $this->createMock(\ilLanguage::class);
 
   54        $new_constraint = $this->constraint->withProblemBuilder(
function () {
 
   55            return "This was a fault";
 
   57        $this->assertEquals(
"This was a fault", $new_constraint->problemWith(
""));
 
   62        $c = $this->constraint->withProblemBuilder(
function (
$txt) {
 
   67        $this->assertTrue(is_callable($this->cls));
 
   74            ->expects($this->
once())
 
   77            ->willReturn($txt_out);
 
   80        $problem = $this->constraint->problemWith($value);
 
   82        $this->assertEquals(sprintf($txt_out, $value), $problem);
 
   87        $lng_closure = $this->constraint->_getLngClosure();
 
   89        $this->expectException(\InvalidArgumentException::class);
 
   96        $lng_closure = $this->constraint->_getLngClosure();
 
  100            ->expects($this->
once())
 
  102            ->with($this->txt_id)
 
  103            ->willReturn($txt_out);
 
  105        $res = $lng_closure($this->txt_id);
 
  107        $this->assertEquals($txt_out, 
$res);
 
  112        $lng_closure = $this->constraint->_getLngClosure();
 
  115            ->expects($this->
once())
 
  118            ->willReturn(
"%s-%s-%s-%s-");
 
  122        $res = $lng_closure(
"id", [], 
new \stdClass(), 
"foo", 
null);
 
  124        $this->assertEquals(
"array-" . \stdClass::class . 
"-foo-null-", 
$res);
 
An exception for terminatinating execution or to throw for unit testing.
TestCase for the custom constraints.
testProblemBuilderRetrievesLngClosure()
test_no_sprintf_on_one_parameter()
test_exception_on_no_parameter()
test_gracefully_handle_arrays_and_objects()
once($eventName, callable $callBack, $priority=100)
Subscribe to an event exactly once.
foreach($_POST as $key=> $value) $res