How CIunit supports HMVC - php

I am using HMVC in my codeigniter project because use it help to group my modules together so that code is better organized.
When I integrate CIunit with codeigniter by following kenjis tutorials from How to use PHPUnit (CIUnit) with CodeIgniter 2.1.0, I got error when I try to run a test.
I get the following error:
[CIUnit] PHP Error: Notice - Trying to get property of non-object File Path: MX/Loader.php (line: 48)
PHP Fatal error: Call to a member function fetch_module() on a non-object in E:\xampp\htdocs\Project\application\third_party\MX\Loader.php on line 48
I read kenjis comments from CIUnit + HMVC Issue.
However, he says it's "ugly", not "impossible" to integrate them. Has anyone done this integration and gotten CIUnit and HMVC to work together?
Thanks in advance.

From my understanding, each module is a mini version of whole CodeIgniter framework. It seems possible to me that you
Set up a CIUnit testing environment with a fresh framework
Add one module's files to corresponding folders
Do testing
Repeat for each module
It would be tedious and time-consuming to set up testing environment for each module at first. But once you set them up, you will be able to test each module without modifying any core files.

Related

What is the replacement for 'require_once' in PHP for Magento2 to resolve CodeSniffer test issue in Magento store?

I'm a beginner at PHP and Magento have developed a Magento2 extension and used this line code in it:
require_once '/../knownuserv3/KnownUser.php';
But when I tried to put my extension in Magento Store, I got a series of test failure from Code Sniffer, which I solved all but for this one couldn't find any solution until now.
knownuser is a class in another library includes a static method which I need to call it.
this is the error text from Code Sniffer:

behat symfony2 facebook api test

im using behat to test my symfony2 projects specifically a test project i have to be a sandbox for my bundles.
One of the bundles to test is my FacebookBundle that integrate facebook api into symfony2 projects. This bundle provide several twig extensions. In the authenticate url of the bundles project i use one of this twig extensions to render the facebook login url but when i test it with behat i get this error:
An exception has been thrown during the rendering of a template ("Notice: Undefined index: HTTP_HOST in /var/www/vendor/facebook/php-sdk/src/base_facebook.php line 1187") in TestBundle:Default:auth.html.twig at line 13.
But i dont see any reason why this is happening, the project work just fine but testing with behat faild.
Any help, thanks
EDIT
Extrange im testing this project on travis and there all behat test pass, see travis: travis-ci.org/bitgandtter/bundles/jobs/37200512
EDIT2
It seams only happend with symfony2 driver for mink, i chage to goutte and work just fine, i review the code and symfony2 driver extend from mink-browse-kit driver, it will be nice to have some configuration options over it, i will keep digging to find the issue

Laravel: how to use my composer installed bundle?

I am learning Laravel. With composer i included the mobile-detect-bundle in the installation (files are in the folders). When i use the code as stated in the docs on github
$mobileDetector = $this->get('mobile_detect.mobile_detector');
i get this error:
**ErrorException**
File does not exist at path mobile_detect.mobile_detector (View: ) (View: )
I use this in my blade view and i think i have to set the path of 'mobile_detect.mobile_detector' but i have no clue what it has to be. Maybe one can give me a push in the right direction?
The reason it's not working is because you are trying to use a Symfony 2 bundle inside Laravel right out of the box.
As the github page says:
Symfony2 bundle for detect mobile devices, manage mobile view and redirect to the mobile and tablet version.
Basically, the line that you are trying to run is the way that you use services inside Symfony. It will work if you are in a Symfony application, but not inside Laravel.
// Get the mobile_detect.mobile_detector
// service from Symfony's service container
$mobileDetector = $this->get('mobile_detect.mobile_detector');
Although there might be some way to make it work, I'd sugggest to search in packagist for a Laravel specific package, or a PHP generic one that provides the same functionality, to make your life easier.
I've made a search and found this one, which is based in Mobile Detect too:
https://github.com/jenssegers/Laravel-Agent

Doctrine/ZF z2d2 tutorial issue

I'm sure that I'm missing something, but I've spent all day and I still can't get this skeleton doctrine integration project by Jason Gilmour to work:
github link
It's quite a simple project, but (after configuring in application.ini) I run into difficulty trying to generate the schema:
./scripts/doctrine orm:schema-tool:create
GIVES
PHP Fatal error: Cannot redeclare class Entities\Account in /var/www/z2d2/application/models/Entities/Account.php on line 12
I think it has something to do with namespaces.
I am using php 5.3.6.
Thanks,
Demian.
I downloaded the source from github here and it seems that the author has made a mistake in the file /application/model/entities/Rank.php. This file is just a duplicate of Account.php - hence the error...
Just delete Rank.php and create your own (or even don't)
Apart from this issue, it looks like a great skeleton to implement zend framework with doctrine.
Thanks for the comments those who responded.
D.

Error with Propel and ZendFramework

After inheriting some Zend Framework code it didn't work, after lots of fiddling I've managed to create the schema and rebuild the models, although now I'm getting the following error:
Call to undefined method Criteria::hasSelectClause() in home/richard/library/om/BaseDomainPeer.php on line 329
Why would propel generate files that call unknown methods?
I would think that you have a name collision and you load some other class called Criteria and you don't realize it because of autoloading. Try dumping the methods using get_class_methods()
Turns out the code was built on a system using the beta version of propel, when i forced my system to use the beta version, it worked.
to use the beta version, go here

Categories