We are toying with Behat to start writing specifications for our PHP applications. All step definition implementation examples are for plain PHP classes, but we are using CodeIgniter as a our prefered framework.
We rule out writing features and scenarios that are UX/UI oriented (that would abstract away the underlying framework) until later in the development stage, and would like instead to test the application layer by accessing the CodeIgniter models.
How do you get Behat to use these models? i.e. how do you integrate Behat with CI?
Download here Behat CI Test
Simple test with Behat and CodeIgniter. The CodeIgniter controller just displays a login page and returns a data array that use to make assertions. There are various debug statements printed with error_log, which Behat displays on stdout, to follow the flow of execution.
Related
I've implemented a laravel project which involves backpack admin, now I want to know is there any appropriate way to test its CRUD functionality (like the store, delete, etc actions)?
It doesn't matter what kind of test is needed (functional or unit test), I just want to test its functionality.
The easiest way I found was to create browser tests using Laravel Dusk - https://laravel.com/docs/8.x/dusk
We have client-side validation and server-side validation as a back up in this Laravel application, and we want to test both, but I can't figure out if that's possible. Is it possible to turn off JavaScript for a single run of the tests, then run them again with it on using Codeception?
Test with PhpBrowser or Laravel5 module.
They can't execute Javascript, so only server side validation is possible.
You will have to create a separate test suite (or use functional if you aren't using it yet) for these tests, because you can have only one of WebDriver, PhpBrowser and Laravel5 modules enabled at a time.
Need to move some code from Code Igniter to Wordpress. It is heavily using CodeIgniter's db classes to handle the database. I would like to use them like this, instead of translating to WP's wpdb.
Is there any way of using Code Igniter active record/db classes and keep the nice CI db usage in Wordpress?
Thanks
If you are using WordPress 3.3 and above, then you can make use of the following library WordPressIgniter
Usually, it's not as straight forward as you think, because both of them have their own code structure. But many have tried it and are successful. It depends on what features you want to use and to what depth.
Following links may come handy for you:
SO - CI WodrePress Integration
http://www.marketingadept.com/blog/integrating-codeigniter-and-wordpress/
I am looking for a clean vanilla example of the play framework with ajax. I would like to build a a dependent dropdown and a chained select. All the tutorials on the web I have found uses php.
The only sample that has ajax makes use of coffee script.
Is there one out there somewhere?
You don't really need a Scala tutorial for that, you can follow the PHP ones.
The difference is that your data (responses) will be returned by Scala routes instead of PHP scripts.
To learn more about AJAX calls in Play just examine a zentasks sample delivered to you together with Play's code. There are samples for both Scala and Java versions and all you have to test them is to go to the folder of selected sample via commandline and run/start it as a common Play's application.
Preview
I am considering php framework Codeigniter & Cakephp for small site I would be developing but I am open to using pretty much any framework does fullfill the following requirements. requirements are:
A simple pre-build user authentication system or login system as a plugin, something long
the lines of php-login-script.
Allows Easy integration with third-part excel/spreadsheet generation library or
has some plugin.
Should support PHP 5.2, hence symfony2 can't be considered
Bonus points if the framework
has integration with twitter
bootstrap
Looking for framework which can fullfill all of the above points, so I can save some time. Else, I would prefer framework which does most of the requirements & would write rest myself.
So, based on above requirements; which php framework/script would you suggest?
CakePHP2
User plugin https://github.com/cakedc/users
Twitter Bootstrap https://github.com/slywalker/TwitterBootstrap
There are plenty of different xls export helpers. Just google it and review them I can not recommend any of them because I have not used them. We have our own but we did not open source it.
Overall I would recommend to use CakePHP2 in any case over Codeigniter. I've recently had to convert a project from CI to Cake and now I know why... ;)
I don't know codeIgniter very well, but for Cakephp I can tell you that:
Authentifiaction is easy to implement.
It's easy to generate xml (which Excel can open), for .xls you'll have to do all by yourself.
supports 5.2
there is a helper for twitter bootstrap, but I've never used it.
For me the deal breaker concerning CodeIgniter is the lack of built-in ORM. You should consider if you need one or not.