llorien / crm

WordPress plugin installed on brithon.com to support managing customer relationship
0 stars 0 forks source link

Errors for the latest unit-test #69

Open helloqiu opened 9 years ago

helloqiu commented 9 years ago

I write a new test for registration.
The register_account() aims to create a new account and register it. I use a fixture to write data into $_POST.But I get errors while running the test:

Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 4.8.6 by Sebastian Bergmann and contributors.

E....4 3 2 1 01-Pro 00-basic .

Time: 7.7 seconds, Memory: 36.00Mb

There was 1 error:

1) Registration_Test::test_register_account
Cannot modify header information - headers already sent by (output started at /private/tmp/wordpress-tests-lib/includes/bootstrap.php:54)

/private/tmp/wordpress/wp-includes/pluggable.php:935
/private/tmp/wordpress/wp-includes/user.php:93
/Users/helloqiu/birchpress/brithon.com/app/wordpress/wp-content/plugins/brithon-crm/modules/registration/model/package.php:75
/Users/helloqiu/birchpress/brithon.com/app/wordpress/wp-content/plugins/brithon-crm/framework/includes/birch.php:112
/Users/helloqiu/birchpress/brithon.com/app/wordpress/wp-content/plugins/brithon-crm/framework/includes/birch.php:228
/Users/helloqiu/birchpress/brithon.com/app/wordpress/wp-content/plugins/brithon-crm/tests/test-registration.php:14
/Users/helloqiu/birchpress/brithon.com/app/wordpress/wp-content/plugins/brithon-crm/tests/test-registration.php:14

FAILURES!
Tests: 6, Assertions: 8, Errors: 1.

@excelle08 told me that this error appears because wp_signon() sends cookie and the way I use register_account() can send header earlier.
But I have no ideas how to solve this. Could anybody help me ? @birchpress/engineering

helloqiu commented 9 years ago

@xueruini

xueruini commented 9 years ago

I was unavailable these days due to personal affairs. will check this soon.

xueruini commented 9 years ago

@excelle08 told me that this error appears because wp_signon() sends cookie and the way I use register_account() can send header earlier.

This post explains the issue in a very good manner, please read it carefully, and figure out the solution:

http://stackoverflow.com/questions/8028957/how-to-fix-headers-already-sent-error-in-php

xueruini commented 9 years ago

@helloqiu have you investigate according to the link I posted?