Пример #1
0
 public function callbackProvider()
 {
     return ['[1]' => [[1], 1, 0], 'S[1]' => [P\Seq::of(1), 1, 0], 'Some(1)' => [P\Some::of(1), 1, 0], 'ArrayObject[1]' => [new \ArrayObject([1]), 1, 0], 'ArrayIterator[1]' => [new \ArrayIterator([1]), 1, 0]];
 }
Пример #2
0
 /**
  * @covers ::orElse
  */
 public function test_orElse($value = 1)
 {
     $some = oppositeSubject::of($value);
     $defaultToSome = function () use($some) {
         return $some;
     };
     $subject = testNew();
     self::assertSame($some, $subject->orElse($defaultToSome));
     self::assertSame($subject, $subject->orElse(testSubject::class));
 }
Пример #3
0
 /**
  * @covers ::filterNot
  */
 public function test_filterNot_return($value = true)
 {
     $subject = testSubject::of($value);
     self::assertSame($subject, $subject->filterNot(bFalse));
     self::assertSame(oppositeSubject::of($value), $subject->filterNot(bTrue));
 }
Пример #4
0
 public function unionDataProvider()
 {
     return ['S[] with Some(1) and []' => [testSubject::of(), [[], P\Some::of(1)], testSubject::of(1)], 'S[1,2,3] with [4], S[5,6], and None' => [testSubject::of(1, 2, 3), [[4], testSubject::of(5, 6), P\None()], testSubject::of(1, 2, 3, 4, 5, 6)], 'S[None, Some(1)] with Some(1)' => [testSubject::of(P\None, P\Some(1)), [P\None(), P\Some(2)], testSubject::of(P\None, P\Some(1), 2)]];
 }