我编写了一个在持续集成环境中执行的PHP CLI脚本.它所做的一件事就是运行Protractor测试.
我的计划是让内置的PHP 5.4的内置Web服务器在后台运行:
php -S localhost:9000 -t foo/ bar.php &
Run Code Online (Sandbox Code Playgroud)
然后运行将使用的量角器测试localhost:9000
:
protractor ./test/protractor.config.js
Run Code Online (Sandbox Code Playgroud)
但是,PHP的内置Web服务器不作为后台服务运行.我似乎无法找到任何可以让我用PHP做到这一点的东西.
可以这样做吗?如果是这样,怎么样?如果这绝对不可能,我愿意接受其他解决方案.
我正在钻研AngularJS的量角器测试世界.
所有教程都建议我webdriver-manager update
在执行测试之后和执行之前执行以下操作:
webdriver-manager start
据该webdriver-manager
男子称,该start
命令将"启动selenium服务器".是的,一旦我运行上面的命令,我可以在http://127.0.0.1:4444/wd/hub看到一些东西
我的问题是:上面有必要吗?
我目前在没有上述命令的情况下运行测试.
我所做的就是:
webdriver-manager update
php -S localhost:8000 -t dist/
protractor ./test/protractor.config.js
即使我已经排除了,我的测试也按预期运行webdriver-manager start
.
有人可以解释为什么webdriver-manager start
有必要吗?
:编辑:
我的量角器/ fooTests.js:
exports.config = {
directConnect: true,
capabilities: {
'browserName': 'chrome'
},
specs: ['protractor/fooTests.js'],
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
Run Code Online (Sandbox Code Playgroud)
我的量角器/ fooTests.js:
describe('test for the bar code', function() {
it('should login', function() {
browser.get('http://localhost:8000');
element(by.model('password')).sendKeys('123456');
element(by.css('[type="submit"]')).click();
});
it('should inspect …
Run Code Online (Sandbox Code Playgroud) 我在Linux Mint 17.2上.我最近删除了红宝石apt-get purge ruby
.
我然后安装rbenv
,然后rbenv install 2.3.0
现在这样做,~/.rbenv/versions/2.3.0/bin/ruby
存在.
但现在,我做不到gem install rubocop
.我明白了:
$ gem install rubocop
rbenv: gem: command not found
The `gem' command exists in these Ruby versions:
2.3.0
Run Code Online (Sandbox Code Playgroud)
但我能做到~/.rbenv/versions/2.3.0/bin/gem install rubocop
.但是,一旦我完成,我就无法使用它:
$ rubocop --auto-correct
-bash: /usr/local/bin/rubocop: /usr/bin/ruby1.9.1: bad interpreter: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我也找不到这颗红宝石的来源:
$ dpkg -S /usr/bin/ruby1.9.1
dpkg-query: no path found matching pattern /usr/bin/ruby1.9.1
Run Code Online (Sandbox Code Playgroud)
它很可能是很久以前通过RVM安装的.
知道如何修复我的Ruby吗?
我正在尝试通过 CLI 运行一个操作。动作是UsersController::test()
所以,我运行这个:
php libraries/lithium/console/lithium.php \\app\\controllers\\UsersController test
但我一直遇到这个错误:
PHP Fatal error: Call to undefined method lithium\console\Request::get() in /var/www/example.com/libraries/lithium/action/Controller.php on line 154
我究竟做错了什么?
我正在使用Lithium和MySQL.我有一个用户模型,hasOne
联系人.联系人模型belongsTo
用户.
我在下面列出了我的代码的一个非常基本的版本.
我的问题:
车型/ Users.php
<?php
namespace app\models;
class Users extends \lithium\data\Model {
public $hasOne = array('Contacts');
protected $_schema = array(
'id' => array('type' => 'integer',
'key' => 'primary'),
'name' => array('type' => 'varchar')
);
}
?>
Run Code Online (Sandbox Code Playgroud)
车型/ Contacts.php
<?php
namespace app\models;
class Contacts extends \lithium\data\Model {
public $belongsTo = array('Users');
protected $_meta = array(
'key' => 'user_id',
);
protected $_schema = array(
'user_id' => array('type' => 'integer',
'key' => 'primary'),
'email' …
Run Code Online (Sandbox Code Playgroud) lithium ×2
angularjs ×1
command-line ×1
daemon ×1
php ×1
php-5.4 ×1
protractor ×1
rbenv ×1
relationship ×1
ruby ×1
selenium ×1
ubuntu ×1