-
Notifications
You must be signed in to change notification settings - Fork 78
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
Getting php-git up to date #70
Comments
Action items for the above are as follows: I can do 2 and 3 once step 1 is done[where we are now]. If anyone knows about how to setup 4 it would save time. |
agreed. I'd like to respect Symfony coding standards for this framework. (not .phpt) It's trivial things but important.
https://gist.github.com/chobie/5f4728121543b8c2f475 Probably you can't send notification with run-tests.php as It made for php qa team. not generic tool. You should wrap test command if you want to send some notifications.
It should be php-git channel at freenode. Don't send any notifications to upstream channel. |
"I'd like to respect Symfony coding standards for this framework. (not .phpt) It's trivial things but important. Symfony's standards don't really apply for extensions... More accurately, the Clar class code design can certainly follow Symfony standards[which means it would need to be namespaced and all] and the php code inside the php file can also follow that design for formatting - though I don't think it should be namespaced or anything[since each script is executed independently on the command line, there isn't any real issue with conflicting function names] But using the phpt standard, with one phpt test file per function makes it extremely easy to figure out where things break. Since it kept all the failed test info, I was able to easily check my new tree test directory on each run to find what the errors were. I'd say that a good rule of thumb is: Should the namespace be php-git/tests or libgit2/php-git/tests ? |
Looks like run-tests.php is created by phpize. I've modified config.m4 to overwrite that when configure is executed here It will need some changes in order to point it someplace where the data can be reported. I'll check libgit2 to see how they are doing it currently. |
ah sorry, less explanations. Will you port clar like testing library, right? I think it should have follow some coding standards. Sometimes people get confused when writing variable names. as PHP has several coding rules.
I think we don't need namespace for Testing framework as it only use for internal test cases. |
woot, I don't know that option. it looks nice |
checking the github api, it looks like issues can be created anonymously in public projects - and there is an irc service that can be enabled per repo to post notifications to a server/channel. Later this week I'll look into modifying the custom run-tests.php and have it post failure reports to the php-git issue tracker[preferably with a tag or marker so they can be filtered out of "real" open issues]. With that setup, then you can update the repo settings to post notices to irc. Or something completely different if some more of the people I e-mailed come by and build consensus on an alternate. I just need 'something' in place because I have to build tests anyway for my own usage and I'd rather they get into the platform so it can be updated and I can be assured that future changes either won't break things I am doing, or if they do break things I'll at least know /why/. |
Oops, I've missed this comment. |
I'd really like to get php-git updated and get a version bump - along with having a dev branch based on the latest libgit2 dev code.
To that end, what php-git needs the most right now are unit tests to ensure all the functionality it does provide is working.
While I added a unit test yesterday, it's a pretty crappy one and I will be submitting a replacement - before I start that I wanted to get feedback from other contributors/users of php-git.
For one thing, rather then writing our own tests, I'd like to use the model from libgit2
https://github.com/libgit2/libgit2/tree/v0.20.0/tests
The resources directory contains a large number of git repositories for testing. Rather then getting them from that folder, I want to copy that folder into our own - that way when changing libgit2 versions if the api has changed our copies will fail showing where the api needs to be changed.
Secondly, I want to create a php version of https://github.com/libgit2/libgit2/blob/v0.20.0/tests/clar.c. clar provides the basic functions to initialize tests. I was thinking of an abstract class with static functions like. Since php already has a unit testing process, we don't need most of the functionality of clar, just some little bits like cl_git_sandbox_init("testrepo") - for libgit2 this function will create a subdirectory in the folder where the test is running, copies the testrepo folder over from resources which is a predefined git repo, and copies the .gittree folder to .git in order to make it an active git repo.
So something like:
Clar::sandbox_init($reponame)
and
Clar::sandbox_cleanup($reponame)
Would be sufficient to create the repo and then clean up afterwards.
Thirdly, I'd rather use the libgit directory model where possible, so instead of https://github.com/libgit2/php-git/tree/develop/tests/tree
I should have placed that test under
tests/object/tree/read/
Where read.c is the libgit2 unit test file that I copied that test from.
I find this helpful in that instead of coming up with our own tests and hash id's, we can use the ones already written for libgit2
I'd also like to follow the guidelines for php:
https://qa.php.net/write-test.php
Under that standard instead of
git_tree_lookup.phpt
Which tests both the success and failure of looking up a directory, I should have written
git_tree_lookup_basic.phpt
git_tree_lookup_error.phpt
Which gives 2 tests to make it easier to determine what is wrong.
It would also be helpful if run-tests.php could be setup to post fail logs to one of the irc channels[either #libgit2 or #php-git) rather then sending e-mail to a PHP mailling list.
There are a LARGE number of tests so I don't expect them to be done right away, but if we all pitch in we can fill them in as we use php-git[ie if you are using the git_tree_lookup function and there is no unit test for it - spend 45 minutes and write a few based on the libgit2 tests. It will save you time since by doing so you can both verify that it works, and learn how it works!
Before setting up the framework, I wanted to check to see if anyone here has a different preferred way of doing things, since I'm more likely to get help if I use a framework others will enjoy, or at least tolerate.
The text was updated successfully, but these errors were encountered: