How to create separate project to test PHP application in IntelliJ 2016? - php

I have a project that is written in PHP with IntelliJ. I need to create a new IntelliJ project that contains only tests for the PHP application. I can't use classes from the application in the tests project. How can I add other project as a dependency for my project that contains the tests?
I have tried using IntelliJ module settings but I don't see the dependencies tab.

I'm not sure if it works exactly like that in IntelliJ, but in PhpStorm 2016 you can do as follows:
Open Project view (View -> Tool Windows -> Project) and locate External libraries at the bottom:
Press F4 or right click -> Configure PHP Include Paths. You should see this window:
Press the + icon at the bottom of the window and locate the directory with the classes that you want to test. IntelliJ should add them as a library, which means all autocompletion features will include the classes, but you will be warned when you try to edit these files.

Related

NetBeans - AngularJS project within a PHP project, all using the same git repo

I just inherited an application that is Magento with an Angular frontend. The Angular code is wholly contained within a single subdirectory of the Magento application. I can set up a PHP project in NetBeans and I get PHP autocomplete and other goodies, but no love for the Angular .js files. The goal is to have both PHP development goodies and angular development goodies. All the code is in one git repo (else this would not be an issue, I could just have two separate directory trees).
NetBeans will not let you create a project within a project. I've tried stitching the codebases together with a symlink both directions, and either git doesn't like it (refusing to treat the symlink as a directory), or NetBeans doesn't like it (still seeing the Angular files as residing with the already existent PHP project).
Anybody have any ideas? Changing the repo structure (like using a git submodule) is not an option currently.
You cannot make "a project inside a project", that is correct. :)
In your project, check if in Remote Files (next to Source Files in the Projects tab) you have the necessary JS files. If not, you have to link to them in your project.
Also what version of Netbeans are you using? It should work in the latest ones (8.1 and up) but may not work in earlier (8.0 and below).

Netbean autocomplete doesn't work in some folder

I have a Yii 1.x project, and i use Netbeans 8.0.2. In this website there is an admin folder in web folder. This is one netbeans project but 2 yii project with one framework (one for users, one for admins). When i am in the web folder the auto complete works, however it doesn't work in web/admin folder.
I tried everything:
-Delete cache manually - C:\Users\username\AppData\Local\NetBeans\Cache\8.0.2
-Reinstall Netbeans
-Delete the project without source code, after create a new project.
-Code completion on. (tools->option->editor->codecompletion)
-Updates
Here is my "about":
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Updates: NetBeans IDE is updated to version NetBeans 8.0.2 Patch 2
Java: 1.8.0_11; Java HotSpot(TM) 64-Bit Server VM 25.11-b03
Runtime: Java(TM) SE Runtime Environment 1.8.0_11-b12
System: Windows 7 version 6.1 running on amd64; Cp1250; hu_HU (nb)
User directory: C:\Users\Siki\AppData\Roaming\NetBeans\8.0.2
Cache directory: C:\Users\Siki\AppData\Local\NetBeans\Cache\8.0.2
So can i enable auto complete?
Since you are using Yii 1.x, there is a certified NetBeans plugin for Yii 1.x in its plugin repository. This plugin will provide options like
Creating new Yii project from netbeans. No need to use Terminals
Code completion.
Go to a Class file by clicking on accessible snippets.
Plug this in you NetBeans to get above benefits as well as to overcome auto code complication problem, which you mentioned in your post.
Plugin page # http://plugins.netbeans.org/plugin/47246/php-yii-framework-netbeans-phpcc
In project properties > Include path, add the folder where are the yii framework base files
Right click over the project in tab projects, then select properties
Image project properties
This enables code completion.

IntelliJ Ultimate, Project shows only a few files and does not recognize php

I am imported my Project trough git, the project is a php project running on symfoy2.
However it seems that intelliJ does not recognize it as a php project and therefore only shows a bunch of files (static web files such as .js, images, ... )
I was wondering if there is a fix for this, i did the following already:
- Installed php, symfony2 modules
- I am running IntelliJ Ultimate
I removed the existing modules (in project structure settings) and added the web module, that fixed my issue

IntelliJ PHP Application Losing Module after close

Not sure how to troubleshoot this problem. I have an IntelliJ Ultimate Edition, used in 64-bit, which I use for a PHP project with several modules. This project has 3 modules, but every time I close Intellij 11, when I open IntelliJ again, I find that the module has disappeared.
Steps that I have used to add this PHP module:
File->Add Module->Create Module From Existing Sources and I select the directory with the module.
or
File->Add Module_>Import Module from IML (I've tried importing the the module-level IML file for the disappearing module), but regardless of which I try, I still fail to retain the 3rd module on the restart of my IntelliJ and I end up having to add the module again.
Edit: A hack to get around this issue is to import the top level IML file into your project. IntelliJ will reorganize the project to show the entire tree structure of your folders.
PHPStorm handles this more effectively than IntelliJ Ultimate. I'd say, that's the only way it's not better than PHPStorm itself.
It's not intuitive, but what you need to do instead is create a new project in the directory containing your existing sources, and choose "Web Module".

How to setup eclipse ide for php development with pre-existing source

I have been using Dreamweaver for my web development and would like to try out eclipse. I would like to keep the source files where they are now. What do I need to set for my workspace and then how do I set it to look at my existing files?
You'll want to set up a workspace in the parent directory of the folder containing that project. Then, you'll create a new PHP project in Eclipse with the same name as the folder containing that project. That should get you going!
For example say you have a folder called Development. Inside that you have a folder called MyProject which contains all the subdirectories and code for your PHP project. On startup you'll select Development for your workspace and then create a PHP project called MyProject.
Eclipse PDT:
1: New -> Local PHP Project. Create it wherever you want (e.g your workspace).
2: Import -> File System. Select the root of your source code.
3: Click Advanced -> Create Links.
Now all source files will be edited in their current location.
Have you setup Eclipse for PHP Developers?
http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/galileo/SR2/eclipse-php-galileo-SR2-win32.zip
As far as I remember, it leaves the source files intact.

Categories