-
Notifications
You must be signed in to change notification settings - Fork 20
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
Remove dependency on Pimple #21
Comments
Here is solution, but PR is on you:
That should ensure that we keep public interface of container the same no matter which Pimple version is used beneath it. |
Fact that Silex doesn't upgrade to Pimple 2/3 doesn't make me any happier either. |
Original Pimple is around 80 LOC while phpunit-mink is using maybe half of its features. Is it really worth to keep that dependency and increase coupling? In this particular scenario (phpunit-mink as independent library) I'd rater go for higher cohesion, even if it means re-implementing few simple features. How about that idea? |
OK. Then:
|
I've just done what you've suggested, but it came with it's own set of problems. Not to mention autoload pain, but Pimple tests is full of checking if service is of particular class, like: $this->assertInstanceOf('Pimple\Tests\Fixtures\Service', $serviceOne); I don't think changing all those assertions to match new namespace is wise idea in terms of maintenance. |
By copy-pasting Pimple code into the library we all understand that it's one way trip and we won't be porting any new Pimple releases (unless some serious bugs will be fixed). I think you safely do You can already send PR with what you have for review if you wish. Also make sure coding standards pass, because I bet Pimple uses 4 spaces indentation, but it should be 1 tab instead. |
Crated PR #22 - it is work in progress (failing tests). Files were just copied, so they adhere to Pimple coding standards. I see that phpunit-mink has got its own coding standards, but I don't know it nor how to check it. Please advise. |
Any specific reason why you gave me push access to your fork of my repo? |
I'm using same coding standard on all my projects: https://github.com/aik099/CodingStandard . Please see it's repo for instructions on how to connect and use it. |
Updated contributing instructions with help how to check coding standards, see #23 PR. I guess it is important for you, so better to have it noted :) Regarding push access to my fork - I might be away for next few days, so it's in case you want to mess with it a bit. |
I'm in no hurry. I guess next code versions will be after you get back from the place where you're going for a few days. |
It seems that I've misunderstood the value proposition of phpunit-mink On 7 November 2014 16:26, Alexander Obuhovich notifications@github.com
|
Any specific problems, that you're experiencing (except Composer dependency issue), that I can help solve besides usual use cases described in http://phpunit-mink.readthedocs.org/en/latest/ ? The library is basically very simplified version of Behat so you can use Mink with PHPUnit and have your sessions automatically reset after each test or test case. If you're not into Behat but like to test in isolation then library is for you. Support for writing test once and running it in different browsers is quite a unique feature as well. I took the idea from https://phpunit.de/manual/current/en/selenium.html and replaced Selenium-only restriction with Mink to allow any driver usage. Currently Selenium-only support is implemented due lack of time and not much practical usage from my side (I'm occupied by other projects in my company), but it's really easy to add support for other drivers by changing https://github.com/aik099/phpunit-mink/blob/master/library/aik099/PHPUnit/Session/SessionFactory.php. All parameters from browser configuration are available there. |
Another thing you can try together with PHPUnit is QA-Tools library (http://www.qa-tools.io) for PageObject approach to UI testing. |
Thanks for your help. Let me provide some context: we're a team new to test automation that is looking for functional test tool for greenfield project. It is typical backoffice web app (mostly forms). Regarding tools we already use PHPUnit for unit tests and reporting test results on Jenkins CI. We're looking at Mink for flexibility: light tests on dev machine (BrowserKit) and full-featured on Jenkins (using Selenium web driver). Which tool you'd suggest in our case? This QA-Tools lib looks interesting, but not sure how it compares with phpunit-mink tool. |
These are 2 different products. What PHPUnit-Mink does I've explained in https://github.com/aik099/phpunit-mink/issues/21#issuecomment-62630853, but below is short explanation of QA-Tools: The QA-Tools library is stand-alone product inspired by Selenium Java client using annotations, but Selenium-only solution (not bound to Behat/PHPUnit, only required Mink session obtained from any source to work), which follows PageObject pattern to allow you abstract HTML under test into logically separated methods/classes. It can be used with Behat (there is experimental integration module) and with PHPUnit (PHPUnit-Mink can be used for that) Example:
$form = $session->getPage()->find('css', 'form');
$form->findField('username')->setValue($username);
$form->findField('password')->setValue($password);
$form->findField('submit')->click();
$some_page = new SomePage();
$some_page->login($username, $password); You can see more examples here http://www.qa-tools.io/examples/02-HtmlElements/ Also thanks to annotation you don't need to write much code either, because all selectors (css, xpath, etc.) are written in class property DocBlock and elements are instantiated on demand automatically when you access them.
I'm using MinkSelenim2Driver/Zombie combination for testing, haven't tried BrowserKit (except for running it's own tests being one of core Mink contributors). But I'm sure that you can change |
Mink is too flexible:
QA-Tools is different because it has typified element classes, that only have relevant methods and IDE auto-complete is happy about that. |
@adambro , is there anything else I can help you with? Have you tried the suggested approach? |
Finally we've went with QA Tools and PageObject - thanks for suggestion. I've managed to write those tests as PHPUnit test cases, so reporting and running is sorted out. Unless you see value in removing Pimple dependency altogether I'm done with phpunit-mink for now. |
As I said, if you don't need to test in isolation (session is restarted between tests), then 2 simple As for removing Pimple dependency I don't want you to spend time on this, because it clearly would take a lot of time. As for QA-Tools: the project is way larger then PHPUnit-Mink, but don't have complete documentation yet, except one you see on website and http://docs.qa-tools.io/en/latest/annotations.html page. So if you need more explanation on how things work in there, then feel free to contact me at any time. Please use form at http://www.qa-tools.io/support/ page to ask question instead of creating new issues with questions in them 😉 |
Closing because due lack of development resources. |
@adambro I've decided to reopen your ticket and redo everything according to plan from #21 (comment) except that I'll call vendor "PimpleCopy" instead of "aik099" because I'm not creating it theoretically. |
I've tried to use phpunit-mink with my Silex application, but stumbled upon a roadblock. Silex 1.2 (current stable) uses Pimple ~1.0 while phpunit-mink requires Pimple 2.0 or upper. Composer is not able to resolve the conflicts, as Pimple public interface has changed.
My idea is to remove dependency on Pimple in Composer to avoid conflicts. Some ways I see it can be done:
Personally I'm in favor of Dependency Inversion, but libraries depending on Dependency Injection Container are hard to integrate due to such issues. Let me know your thoughts.
The text was updated successfully, but these errors were encountered: