diff --git a/behat.yml b/behat.yml index 6c3166dde..5e9b6cd80 100644 --- a/behat.yml +++ b/behat.yml @@ -6,7 +6,7 @@ default: contexts: - FeatureContext: cluster_name: php-driver-2.1-cluster - cassandra_version: 2.1.5 + cassandra_version: 2.1.8 cassandra-version-2.0: formatters: @@ -17,7 +17,7 @@ cassandra-version-2.0: contexts: - FeatureContext: cluster_name: php-driver-2.0-cluster - cassandra_version: 2.0.13 + cassandra_version: 2.0.16 cassandra-version-1.2: formatters: diff --git a/features/bootstrap/FeatureContext.php b/features/bootstrap/FeatureContext.php index 3e3ff427e..0d1e09599 100644 --- a/features/bootstrap/FeatureContext.php +++ b/features/bootstrap/FeatureContext.php @@ -163,16 +163,20 @@ public function aFileNamedWith($name, PyStringNode $string) private function fetchPath($url) { - $request = curl_init(); - - curl_setopt($request, CURLOPT_URL, $url); - curl_setopt($request, CURLOPT_HEADER, 0); - curl_setopt($request, CURLOPT_CONNECTTIMEOUT, 2); - curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($request, CURLOPT_USERAGENT, 'PHP Driver Tests'); - - $content = curl_exec($request); - curl_close($request); + if (in_array('curl', get_loaded_extensions())) { + $request = curl_init(); + + curl_setopt($request, CURLOPT_URL, $url); + curl_setopt($request, CURLOPT_HEADER, 0); + curl_setopt($request, CURLOPT_CONNECTTIMEOUT, 2); + curl_setopt($request, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($request, CURLOPT_USERAGENT, 'PHP Driver Tests'); + + $content = curl_exec($request); + curl_close($request); + } else { + $content = file_get_contents($url); + } return $content; } diff --git a/features/sessions/persistent_sessions.feature b/features/sessions/persistent_sessions.feature index efb0c1a82..09688fde2 100644 --- a/features/sessions/persistent_sessions.feature +++ b/features/sessions/persistent_sessions.feature @@ -4,7 +4,7 @@ Feature: Persistent Sessions PHP Driver sessions can persist Background: - Given a running Cassandra cluster + Given a running Cassandra cluster with 2 nodes And a file named "status.php" with: """php withContactPoints('127.0.0.1') + ->withPersistentSessions(true) + ->build(); + $session = $cluster->connect(); + """ + And a file named "connect_system.php" with: + """php + withContactPoints('127.0.0.1') + ->withPersistentSessions(true) + ->build(); + $session = $cluster->connect("system"); + """ + When I go to "/connect.php" + When I go to "/connect_system.php" + When I go to "/status.php" + Then I should see: + | Persistent Clusters | 1 | + | Persistent Sessions | 2 | + Scenario: Non-persistent sessions are recreated for each request Given a file named "connect.php" with: """php