codeception/symfony1module
最新稳定版本:1.0.0
Composer 安装命令:
composer require codeception/symfony1module
包简介
Module for symfony 1.x framework
README 文档
README
Codeception Module that interacts with Symfony 1.4 applications.
Replaces functional testing framework from symfony. Authorization features uses Doctrine and sfDoctrineGuardPlugin. Uses native symfony connections and test classes. Provides additional informations on every actions.
If test fails stores last shown page in 'log' dir.
Installation
In composer.json
"require-dev": {
"codeception/codeception": "~2.1",
"codeception/symfony1module": "*"
}
Status
- Maintainer: davert
- Stability: stable
- Contact: codecept@davert.mail.ua
Configuration
- app required - application you want to test. In most cases it will be 'frontend'
Public Properties
- browser - current instance of sfBrowser class.
amLoggedAs
Log in as sfDoctrineGuardUser. Only name of user should be provided. Fetches user by it's username from sfGuardUser table.
param$name \Exception
amOnPage
Opens the page.
param$page
click
Click on link or button and move to next page. Either link text, css selector, or xpath can be passed
param$link
clickSubmitButton
Emulates click on form's submit button. You don't need that action if you fill form by ->submitForm action.
param$selector
dontSee
Check if current page doesn't contain the text specified. Specify the css selector to match only specific region.
Examples:
<?php $I->dontSee('Login'); // I can suppose user is already logged in $I->dontSee('Sign Up','h1'); // I can suppose it's not a signup page
param$textparam null$selector
dontSeeCheckboxIsChecked
Assert if the specified checkbox is unchecked. Use css selector or xpath to match.
Example:
<?php $I->dontSeeCheckboxIsChecked('#agree'); // I suppose user didn't agree to terms $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user didn't check the first checkbox in form.
param$selector
dontSeeLink
Checks if page doesn't contain the link with text specified. Specify url to narrow the results.
Examples:
<?php $I->dontSeeLink('Logout'); // I suppose user is not logged in
param$textparam null$url
see
Check if current page contains the text specified. Specify the css selector to match only specific region.
Examples:
<?php $I->see('Logout'); // I can suppose user is logged in $I->see('Sign Up','h1'); // I can suppose it's a signup page
param$textparam null$selector
seeCheckboxIsChecked
Assert if the specified checkbox is checked. Use css selector or xpath to match.
Example:
<?php $I->seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms $I->seeCheckboxIsChecked('#signup_form input[type=checkbox]'); // I suppose user agreed to terms, If there is only one checkbox in form.
param$selector
seeEmailReceived
Checks if there were at least one email sent through Symfony test mailer.
seeErrorInField
Checks for invalid value in Symfony1 form. Matches the first sfForm instance from controller and returns getErrorSchema() values. Specify field which should contain error message.
param$field
seeErrorsInForm
Performs validation of Symfony1 form. Matches the first sfForm instance from controller and returns getErrorSchema() values. Shows all errors in debug.
seeFormIsValid
Performs validation of Symfony1 form. Matches the first sfForm instance from controller and returns isValid() value.
seeLink
Checks if there is a link with text specified. Specify url to match link with exact this url.
Examples:
<?php $I->seeLink('Logout'); // matches <a href="#">Logout</a> $I->seeLink('Logout','/logout'); // matches <a href="/logout">Logout</a>
param$textparam null$url
sendAjaxGetRequest
If your page triggers an ajax request, you can perform it manually. This action sends a GET ajax request with specified params.
See ->sendAjaxPostRequest for examples.
param$uriparam$params
sendAjaxPostRequest
If your page triggers an ajax request, you can perform it manually. This action sends a POST ajax request with specified params. Additional params can be passed as array.
Example:
Imagine that by clicking checkbox you trigger ajax request which updates user settings. We emulate that click by running this ajax request manually.
<?php $I->sendAjaxPostRequest('/updateSettings', array('notifications' => true); // POST $I->sendAjaxGetRequest('/updateSettings', array('notifications' => true); // GET
param$uriparam$params
signIn
Sign's user in with sfGuardAuth. Uses standard path: /sfGuardAuth/signin for authorization. Provide username and password.
param$usernameparam$password
signOut
Sign out is performing by triggering '/logout' url.
submitForm
Submits a form located on page. Specify the form by it's css or xpath selector. Fill the form fields values as array.
Skipped fields will be filled by their values from page. You don't need to click the 'Submit' button afterwards. This command itself triggers the request to form's action.
Examples:
<?php $I->submitForm('#login', array('login' => 'davert', 'password' => '123456'));
For sample Sign Up form:
<form action="/sign_up"> Login: <input type="text" name="user[login]" /><br/> Password: <input type="password" name="user[password]" /><br/> Do you agree to out terms? <input type="checkbox" name="user[agree]" /><br/> Select pricing plan <select name="plan"><option value="1">Free</option><option value="2" selected="selected">Paid</option></select> <input type="submit" value="Submit" /> </form>
I can write this:
<?php $I->submitForm('#userForm', array('user' => array('login' => 'Davert', 'password' => '123456', 'agree' => true)));
Note, that pricing plan will be set to Paid, as it's selected on page.
param$selectorparam$params
codeception/symfony1module 适用场景与选型建议
codeception/symfony1module 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2015 年 04 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 codeception/symfony1module 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 codeception/symfony1module 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 14k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-04-30