コード例 #1
0
ファイル: ShrinkingTest.php プロジェクト: giorgiosironi/eris
 public function testShrinkingAString()
 {
     $this->forAll(Generator\string())->then(function ($string) {
         var_dump($string);
         $this->assertNotContains('B', $string);
     });
 }
コード例 #2
0
ファイル: StringTest.php プロジェクト: nicoder/eris
 public function testLengthPreservation()
 {
     $this->forAll(Generator\string(), Generator\string())->then(function ($first, $second) {
         $result = string_concatenation($first, $second);
         $this->assertEquals(strlen($first) + strlen($second), strlen($result), "Concatenating '{$first}' to '{$second}' gives '{$result}'" . PHP_EOL . var_export($first, true) . PHP_EOL . "strlen(): " . strlen($first) . PHP_EOL . var_export($second, true) . PHP_EOL . "strlen(): " . strlen($second) . PHP_EOL . var_export($result, true) . PHP_EOL . "strlen(): " . strlen($result) . PHP_EOL . "First hex: " . var_export(bin2hex($first), true) . PHP_EOL . "Second hex: " . var_export(bin2hex($second), true) . PHP_EOL . "Result hex: " . var_export(bin2hex($result), true) . PHP_EOL);
     });
 }
コード例 #3
0
 public function testLengthPreservation()
 {
     $this->shrinkingTimeLimit(2)->forAll(Generator\string(), Generator\string())->then(function ($first, $second) {
         $result = very_slow_concatenation($first, $second);
         $this->assertEquals(strlen($first) + strlen($second), strlen($result), "Concatenating '{$first}' to '{$second}' gives '{$result}'" . PHP_EOL);
     });
 }
コード例 #4
0
ファイル: SuchThatTest.php プロジェクト: giorgiosironi/eris
 public function testSuchThatAcceptsPHPUnitConstraints()
 {
     $this->forAll(Generator\vector(5, Generator\suchThat($this->isType('integer'), Generator\oneOf(Generator\choose(0, 1000), Generator\string()))))->then($this->allNumbersAreBiggerThan(42));
 }
コード例 #5
0
ファイル: ErrorTest.php プロジェクト: nicoder/eris
 public function testGenericExceptionsDoNotShrinkButStillShowTheInput()
 {
     $this->forAll(Generator\string())->then(function ($string) {
         throw new RuntimeException("Something like a missing array index happened.");
     });
 }