2013-09-27 52 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,就像一个魅力。

我目前没有描述此行为的链接。