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); }
/** * @test * @expectedException InvalidArgumentException */ public function it_throws_an_exception_if_predicate_is_not_a_callable() { $observable = new ReturnObservable(1); $observable->where(42); }
/** * @test * @expectedException InvalidArgumentException */ public function select_expects_a_callable() { $observable = new ReturnObservable(1); $observable->select(42); }
/** * @test * @expectedException \InvalidArgumentException */ public function it_throws_an_exception_on_negative_amounts() { $observable = new ReturnObservable(42); $observable->skip(-1); }
/** * @test * @expectedException \InvalidArgumentException */ public function it_throws_an_exception_on_negative_amounts() { $observable = new ReturnObservable(42); $result = $observable->take(-1); $result->subscribe(new CallbackObserver()); }