小编jag*_*ggy的帖子

Meteor.methods返回undefined

我正在使用流星0.6.4.

Meteor.methods({
  random: function(top){
    var random = Math.floor((Math.random()*(top+1)));
    return random;
  }
});
Run Code Online (Sandbox Code Playgroud)

每当我执行时它返回undefined

Meteor.call('random', 10);
Run Code Online (Sandbox Code Playgroud)

我有什么想法可以超越这个?

meteor

31
推荐指数
1
解决办法
2万
查看次数

在Laravel中访问$ _GET值的最佳做法是什么?

$_GET在Laravel中是否有更好的方式来访问而不是变量本身,还是它?

我需要API的多个参数 /users?q=keyword&order=desc&limit=5

是否有更清洁,更安全和Laravel-ish方式来访问$ _GET值?

谢谢.

parameters laravel

5
推荐指数
1
解决办法
4008
查看次数

phpspec - 获取返回值

我想得到对象的实际返回值而不是可链接对象.

class Foo
{
   public $attribute = 'data';
}

class FooSpec extends ObjectBehavior
{
   public function it_is_a_test()
   {
       $attribute = $this->attribute; // I want to get 'data'
   }
}
Run Code Online (Sandbox Code Playgroud)

这有什么办法吗?

谢谢.

php phpspec

4
推荐指数
1
解决办法
708
查看次数

Meteor.call中的集合不会更新服务器数据

在我sever/publish.js,我有这样的事情:

Questions = new Meteor.Collection("questions");

Meteor.publish("questions", function(){
    return Questions.find();
});
Run Code Online (Sandbox Code Playgroud)

在我client/app.js做这样的事情时:

Questions = new Meteor.Collection("questions");

var questionHandle = Meteor.subscribe("questions");

Meteor.methods({
    post: function(title){
        Questions.insert({title: title});
    }
});

$('.save').on('click', function(){
    var title = $('input[name="title"]').val();
    Meteor.call('post', title);
});
Run Code Online (Sandbox Code Playgroud)

它不起作用!但是,如果我把代码放在自身之外,服务器数据会更新.

Questions = new Meteor.Collection("questions");

var questionHandle = Meteor.subscribe("questions");

$('.save').on('click', function(){
    var title = $('input[name="title"]').val();
    Questions.insert({title: title});
});
Run Code Online (Sandbox Code Playgroud)

这是一个错误还是我错过了什么?

meteor

2
推荐指数
1
解决办法
678
查看次数

使用Selenium Webdriver和PHPUnit截图

我知道截图可以通过扩展来实现,PHPUnit_Extensions_Selenium2TestCase但是现在,我正在使用Facebook的php-webdriver所以我只是延伸PHPUnit_Framework_TestCase

无论如何,只有驱动程序而不是扩展扩展名才能截取屏幕截图?

谢谢.

php selenium phpunit

2
推荐指数
2
解决办法
2690
查看次数

PHPUnit 和 Selenium 以及从元素问题中获取价值

所以我从PHPUnitSelenium 2 开始

public function testHasALoginForm()
{
    $this->url('/login');

    $username = $this->byName('username');
    $password = $this->byName('password');

    $this->assertEquals('', $username->value());
    $this->assertEquals('', $password->value());
}
Run Code Online (Sandbox Code Playgroud)

这只发生在我value()从元素调用方法时,我最终得到:

1) test\view\LoginTest::testHasALoginForm
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: GET /session/fdcf0669-1d42-4a35-8e7a-29dec4a0f1e4/element/0/value
Build info: version: '2.42.1', revision: '68b415a', time: '2014-05-29 16:16:49'
System info: host: 'Something.local', ip: '192.168.1.108', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.3', java.version: '1.8.0_05'
Driver info: driver.version: unknown
Run Code Online (Sandbox Code Playgroud)

难道我做错了什么?

php testing selenium phpunit

1
推荐指数
1
解决办法
1276
查看次数

标签 统计

php ×3

meteor ×2

phpunit ×2

selenium ×2

laravel ×1

parameters ×1

phpspec ×1

testing ×1