单命令代码& Symfony测试?

时间:2015-09-18 21:11:12

标签: php symfony phpunit codeception

在捆绑中具有现有WebTestCase功能测试的应用程序添加了一些代码验收测试。例如,运行包含两组测试的代码覆盖率命令会很好。这可能吗?对于初学者而言,functional.suite.yml codecept run functional不会在class_name: FunctionalTester modules: enabled: - \Helper\Functional - Asserts - Db: dsn: 'sqlite:./app/cache/test/test.sqlite' user: '' password: '' dump: tests/_data/test.sql populate: true cleanup: true reconnect: true - Symfony2: app_path: ./app var_path: ./app environment: test groups: symfony: - ../src/AppBundle/Tests/Controller/AdminControllerTest.php 上引发任何错误,但也会说

  

没有执行测试!

functional.suite.yml

namespace AppBundle\Tests\Controller;

use Liip\FunctionalTestBundle\Test\WebTestCase;

/**
 *
 * @group symfony
 *
 */
class AdminControllerTest extends WebTestCase
{
...
}

AdminControllerTest摘录

...

var http = require('http');

emails.send = function *(next) {
    // Pull the HTML for email to be sent from another local server
    mailOptions['html'] = yield* emailHtml();
    ...
};

function* emailHtml() {
    // Get the data from the database -- ends up using node-sqlite
    var data = yield mea.getMeasurements();

    // Callback function to deal with http request below
    function callback(response) {
        var str = '';

        response.on('data', function(chunk) {
            str += chunk;
        });
        response.on('end', function(chunk) {
            return str;
        });
    }

    // Make a request to the other server to get it's HTML
    var req = http.request(options, callback);
    // Post the data from this server's database connection to the other server to be processed and sent back
    req.write(JSON.stringify(data));
    req.end();

    return ??????;

}
...

0 个答案:

没有答案