Ejemplo n.º 1
0
 public function testReturnObservableSubscribeTwice()
 {
     $o = new ReturnObservable("The Value");
     $goodCount = 0;
     $o->subscribe(new CallbackObserver(function ($x) use(&$goodCount) {
         $this->assertEquals("The Value", $x);
         $goodCount++;
     }));
     $o->subscribe(new CallbackObserver(function ($x) use(&$goodCount) {
         $this->assertEquals("The Value", $x);
         $goodCount++;
     }));
     $this->assertEquals(2, $goodCount);
 }
Ejemplo n.º 2
0
 /**
  * @test
  * @expectedException InvalidArgumentException
  */
 public function it_throws_an_exception_if_predicate_is_not_a_callable()
 {
     $observable = new ReturnObservable(1);
     $observable->where(42);
 }
Ejemplo n.º 3
0
 /**
  * @test
  * @expectedException InvalidArgumentException
  */
 public function select_expects_a_callable()
 {
     $observable = new ReturnObservable(1);
     $observable->select(42);
 }
Ejemplo n.º 4
0
 /**
  * @test
  * @expectedException \InvalidArgumentException
  */
 public function it_throws_an_exception_on_negative_amounts()
 {
     $observable = new ReturnObservable(42);
     $observable->skip(-1);
 }
Ejemplo n.º 5
0
 /**
  * @test
  * @expectedException \InvalidArgumentException
  */
 public function it_throws_an_exception_on_negative_amounts()
 {
     $observable = new ReturnObservable(42);
     $result = $observable->take(-1);
     $result->subscribe(new CallbackObserver());
 }