addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwchatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgoogleimageimagesinstagramlinklocation-pinmagnifying-glassmailminusmoremuplabelShape 3 + Rectangle 1outlookpersonplusprice-ribbonImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruseryahoo

Re: [mysql-144] Re: [TriPUG] Tripug: PHP Best Practices

From: Neal A.
Sent on: Monday, August 16, 2010 8:39 PM
As I am just beginning down the road of a large project that consists of mostly completely new code (some of it based on existing functionality and some of it greenfield) I'm struggling with the right approach to developing unit tests.. specifically for the brand new functionality that might be covering uncharted territory and have only loosely defined specifications or user stories or test cases.

For the 'porting' of existing functionality there is at least some derived structure and examples of what should go in, what should come out, and what validates a test.

In the case of brand new functionality, where the development of the code may evolve via trial and error and over time until the right approach or implementation is achieved, where opportunities for optimization and re-factoring may occur, I'm hesitant to also carry the burden of re-writing the unit tests that would go along with such a liquid part of the code base.

There are some who would say:  Write your unit test first and then code.

And some who might prefer to write tests as you code.

I'm wondering if it's ever ok to write your code, then your test case.

..and if there are certain indicators of if'/when one approach is better over another?


From: Steve W. <[address removed]>
To: [address removed]
Sent: Mon, August 16,[masked]:39:27 PM
Subject: Re: [mysql-144] Re: [TriPUG] Tripug: PHP Best Practices

There seems to be some debate on using PHPUnit for Unit testing and
Functional Testing.
PHPUnit looks interesting and there are some fine addons - like
coverage testing for larger projects.

On Mon, Aug 16, 2010 at 12:23 PM, Michael Kimsal <[address removed]> wrote:
> Some other 'best practices' (or perhaps just 'good practices').
> 1.  Write unit and functional tests.
> 2.  As Bryan said, use meaningful variable names.
> 3.  Adopt a style and use it consistently (I still struggle with this a bit).
> 4.  Use tabs, not spaces :)
> 5.  Use phpdoc on your methods and functions.
> Any others you all want to contribute?

Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Steve W. ([address removed]) from The Raleigh MySQL/PHP Meetup Group.
To learn more about Steve W., visit his/her member profile:
To unsubscribe or to update your mailing list settings, click here:
Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy