-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
phpunit support? #62
Comments
This "odd syntax" is what PHP itself uses for testing. And I have to say, it is way more readable and practical than PHPUnit and similar testing frameworks. Your patch is very nice example why PHPUnit-like tests are bad. Your code looks like many other tests I saw, nothing bad at the first sight, but... First, "109 additions and 40 deletions." ... the same feature, double the code. That is a bad sign. Second, comparing the basic test I noticed few things.
Take a look at PHPT -- http://qa.php.net/write-test.php and give it a few minutes of exploring. Point is, that tests are not only to verify that code works. Actually that is one of minor reasons why tests exist. Good tests are awsome documentation -- working examples ready to run and experiment with. PHPT tests are also perfect as playground during development. You can write code, let it dump whatever is interesting, and once code works, little cleanup of debug dumps, copy-paste to expected section and feature is ready, including tests as an almost free side product. And the most important, tests must be extremely easy to write. Otherwise nobody would write them. |
Hey, thanks for your feedback. It really wasn't my idea to start a phpunit-phpt war, and I can truly understand that my patch could have been interpreted that way -- please excuse me if I was rude. Regarding your comments: Second,
I'm not saying that phpt tests are bad; they are a good match for limited environments (such a php internals) but the defacto standard for php projects is phpunit. |
No excuse needed. ;-)
Not really. The test you replaced has 10 lines of code. The rest, the "expected output", is written automatically and programmer only have to confirm that it is correct (by copy-pasting it into the file). That is the trick which makes such tests much easier to write.
PHPT executes each test in new PHP instance (new process for each test). So if database is prepared and cleaned up correctly, there is no way they could interfere. Am I right? Does PHPUnit also execute each test in new process?
With plain text diff there is no need for assert library in the first place. In some cases it may be better to use assert, but such case can be solved using better format of test output.
150 lines of your commit says otherwise ;) It is ok to say that something is bad. I'm using PHPT in few other projects and I really want to know, whether there is a reason why I should not, or where are limits and shortcommings of such approach. Or if PHPUnit can provide some killer features which are worh writing more ugly tests. |
@eridal I appreciate your effort but sorry I agree with @jkufner. I don't see any advantages. On the other hand I see many drawbacks:
Try to imagine someone who doesn't know phpt neither phpunit. What is easier to read for newbie? IMHO phpt. On the other hand your reason for phpunit "defacto standard for php projects" is only |
I understand and respect your decision, however I think it's not in line with current modern development standards; test runner integration, coverage reports, profiling, dependency analysis are some benefits phpunit can bring (just on top of my mind) to the project. Anyways, I'm not here to enlighten anybody.. so let's keep this closed as it's. |
I saw the test files are written using some odd phpt syntax.
Is there a plan for adding phpunit support? how much coverage this project have?
The text was updated successfully, but these errors were encountered: