Phalcon and TDD

719 views
Skip to first unread message

Davert

unread,
Oct 23, 2012, 1:15:53 PM10/23/12
to phalcon-...@googlegroups.com
I like Phalcon, I think it's awesome project which is feels like a new breath of fresh air in the world of slow and robust PHP frameworks like Zend or Symfony.
When I saw a Symfony2 project with 30 secs page load, I realized, PHP can't be as enterprisy as community think of it. So I really appreciate your work, and I hope one day Phalcon will rule the world!

Meanwhile, I think Phalcon has some lack of testing tools. Well, most of PHP frameworks have problems with that. And you can say testign tools can be standalone, but better to bring them in a package with framework, or at least recommend them in documentation, to have developers use the best practives, such as TDD and BDD.

I am lead developer of Codeception Testing Framework http://codeception.com/
It is PHPUnit + BDD + functional tests. By default it has integrations with multiple frameworks, and Phalcon can be one of them.

I think by Codeception and Phalcon projects can benefit from our partnership.
Phalcon can receive the simplest and most powerful functional testing tool and very tight integration. 
Codeception will add new option to the stack of supported frameworks, and I hope to that codeception can be supported/recommended by default for testing.

If you are interested in collaboration, we can discuss what steps we need to make a proper integration (and why do developers need it).

P.S. I hope you are not writing a TDD framework on C right now :) I know, you can =)

Andres-Gutierrez

unread,
Oct 23, 2012, 2:07:14 PM10/23/12
to Davert, phalcon-...@googlegroups.com
Thanks Davert, maybe the phalcon developer tools can generate some prepared unit-tests using codeception,

Can you provide us help/support to create a plugin for Phalcon?

2012/10/23 Davert <dave...@gmail.com>
--
 
 

Davert

unread,
Oct 25, 2012, 8:49:32 PM10/25/12
to phalcon-...@googlegroups.com, Davert, andres.g...@phalconphp.com
Unit tests are pretty common everywhere. And Codeception doesn't reinvent the weel, as it's based on top of PHPUnit.

The major feature of Codeception are functional tests. You are not testing the Controller class, but it's actual behavior, from the user's perspective.
It would be cool if you can test the CRUD functionality by emulating the user, but without connecting to actual web site.
Codeception connects to the application, emulates requests, parses responses, and submits next requests...

And so you can run this scenario without touching a browser or webserver

$I = new WebGuy($scenario);
$I->wantTo('create wiki page');
$I->amOnPage('/');
$I->click('Pages');

The problem here is that our web application stays in memory, instead of dying after each request (as it's used in PHP). 
And so we need to perform a complete clean up each time the request is sent. 

Basically I need to know: what's with memory management? Will the long-living application work on top of Phalcon? What should be cleaned?
How the headers are sent? Can they be skipped in test environment?
Do you have a test environment?
Does your ORM support nested transactions? This way we can roll back all the changes after the test.

And about unit tests... 
They are cool, but they shouldn't be the first to write for a web application. As web developer should see an applications works as a whole, and not just one class.
And that's why I think functional tests are important. 


Вівторок, 23 жовтня 2012 р. 21:07:35 UTC+3 користувач Andres-Gutierrez написав:

Andres Gutierrez

unread,
Oct 31, 2012, 4:33:45 PM10/31/12
to phalcon-...@googlegroups.com, Davert, andres.g...@phalconphp.com
Hi Davert,

Thanks,

The headers are stored in a headers bag, you may optionally throw it and the ORM support transactions too,

here's the docs: http://docs.phalconphp.com/en/0.6.0/index.html

Davert

unread,
Nov 2, 2012, 12:29:00 PM11/2/12
to phalcon-...@googlegroups.com, Davert, andres.g...@phalconphp.com
Cool, when I get time I will try to implement this.

Is there any example project I can start with?

Середа, 31 жовтня 2012 р. 22:33:45 UTC+2 користувач Andres Gutierrez написав:

hdo...@gmail.com

unread,
Nov 10, 2012, 4:23:06 PM11/10/12
to phalcon-...@googlegroups.com, Davert, andres.g...@phalconphp.com

Davert

unread,
Nov 11, 2012, 4:11:53 AM11/11/12
to phalcon-...@googlegroups.com, Davert, andres.g...@phalconphp.com
Thanks! I hope I will get some time soon and work on integration.

Субота, 10 листопада 2012 р. 23:23:06 UTC+2 користувач hdo...@gmail.com написав:
Reply all
Reply to author
Forward
0 new messages