public function testDeadConnectionsAreSkipped()
 {
     $mock1 = new FullMockConnection();
     $mock1->setReturnValue("isAlive", false);
     $mock1->expectOnce("start");
     $mock1->expectNever("read");
     $mock2 = new FullMockConnection();
     $mock2->setReturnValue("isAlive", false);
     $mock2->expectOnce("start");
     $mock2->expectNever("read");
     $mock3 = new FullMockConnection();
     $mock3->setReturnValue("isAlive", true);
     $mock3->setReturnValueAt(0, "isAlive", false);
     $mock3->setReturnValueAt(1, "isAlive", true);
     $mock3->expectOnce("start");
     $mock3->expectOnce("read");
     $multi = new Swift_Connection_Rotator();
     $multi->addConnection($mock1);
     $multi->addConnection($mock2);
     $multi->addConnection($mock3);
     $multi->start();
     $multi->read();
 }
 public function testIsAliveReturnsFalseIfTheConnectionIsClosed()
 {
     $mock1 = new FullMockConnection();
     $mock1->setReturnValue("isAlive", false);
     $mock1->expectOnce("start");
     $mock1->expectNever("stop");
     $mock2 = new FullMockConnection();
     $mock2->setReturnValue("isAlive", true);
     $mock2->expectOnce("start");
     $mock2->expectOnce("stop");
     $multi = new Swift_Connection_Multi();
     $multi->addConnection($mock1, "mock1");
     $multi->addConnection($mock2, "mock2");
     $multi->start();
     $this->assertTrue($multi->isAlive());
     $multi->stop();
     $this->assertFalse($multi->isAlive());
 }
 public function testConnectionIsNotStartedIfNO_STARTFlagIsSet()
 {
     $conn = new FullMockConnection();
     $conn->expectNever("start");
     $swift = new Swift($conn, null, Swift::NO_START);
 }