2013-09-27 39 views
0

我試圖使用zombie.js(嘗試了2個symfony2應用程序和相同結果)來驗證PHP應用程序。但是回調中的瀏覽器會話不一樣。我認爲這是爲什麼認證失敗。zombie.js在回調中丟失會話

這裏是我的Node.js代碼

var Browser = require("zombie"); 
var assert = require("assert"); 

// Load the page from localhost 
var browser = new Browser(); 
browser.site = "http://localhost:8000/"; 
browser.loadCSS = false; 
browser.debug = true; 

browser.visit("app.php") 
    .then(function(){ 
     console.log(browser.cookies.dump()); 

     browser.visit("app.php") 
      .then(function() { 
       console.log(browser.cookies.dump()); 
      }); 
    }); 

browser.visit("app.php") 
    .then(function(){ 
     console.log(browser.cookies.dump()); 
    }); 

而且回調

$ node test.js Zombie: Opened window http://localhost:8000/app.php 
Zombie: Closed window http://localhost:8000/app.php 
Zombie: Opened window http://localhost:8000/app.php 
Zombie: GET http://localhost:8000/app.php => 200 
Zombie: GET http://localhost:8000/app.php => 200 
Zombie: Loaded document http://localhost:8000/app.php 
Zombie: GET http://localhost:8000/app.php/js/0b50c2c.js => 200 
PHPSESSID=3qsqvtaseidgb5599803evt604; Domain=localhost; Path=/ 
[ true ] 
Zombie: Closed window http://localhost:8000/app.php 
Zombie: Opened window http://localhost:8000/app.php 
PHPSESSID=3qsqvtaseidgb5599803evt604; Domain=localhost; Path=/ 
[ true ] 
Zombie: GET http://localhost:8000/app.php => 200 
Zombie: Loaded document http://localhost:8000/app.php 
Zombie: GET http://localhost:8000/app.php/js/0b50c2c.js => 200 
PHPSESSID=jg9h8e2orbmbfq0dr65ni8ucs7; Domain=localhost; Path=/ 
[ true ] 
Zombie: Event loop is empty 

它是zombie.js的錯誤有不同phpssid的結果?

回答

0

這是由於php 5.4內置的服務器。 我已升級到PHP 5.5,就像一個魅力。

我目前沒有描述此行爲的鏈接。