Atom PHP lint not working Windows 10 - php

I have fresh installation of Atom. Installed linter package and then linter-php.
In config.cson file i have following
"*":
"exception-reporting":
userId: "c545e431-a953-b271-c123-c021c950953b"
welcome:
showOnStartup: false
core: {}
editor:
invisibles: {}
tabLength: 4
linter: {}
"linter-php":
executablePath: "C:/php/"
I downloaded PHP zip from http://windows.php.net/downloads/releases/php-5.6.16-Win32-VC11-x86.zip and extracted inside C:/php
Can any one help me out in fixing this. I don't find any thing i am missing.
Update
This is the error i am getting
Error: 'C:/php/' is not recognized as an internal or external command,
operable program or batch file.
at parameters.exit (C:\Users\Raheel\.atom\packages\linter-php\node_modules\atom-linter\lib\helpers.js:70:20)
at triggerExitCallback (C:\Users\Raheel\AppData\Local\atom\app-1.2.4\resources\app.asar\src\buffered-process.js:213:47)
at ChildProcess.<anonymous> (C:\Users\Raheel\AppData\Local\atom\app-1.2.4\resources\app.asar\src\buffered-process.js:235:18)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)

I just went through the same thing. Here is my config.cson file. I'm using wamp for local PHP testing so my path will look different to the php.exe but the concept is the same.
"*":
core:
...
welcome:
showOnStartup: false
linter: {}
"linter-php":
executablePath: "C:/wamp/bin/php/php6.5.12/php.exe"
Hope this helps! (BTW the ... is just extra stuff in my config.cson file that wouldn't have helped)

Related

phpfmt php formatting extension eror: phpfmt: php_bin "php" is invalid

Recently I updated my VS code on my macOS. I'm now running vs code version 1.41.1.
Ever since the reinstall, the phpfmt extension is no longer working and giving me the
phpfmt: php_bin "php" is invalid`
pop up every time I save a file.
I tried removing VS code and installing it again. I removed the extension and reinstalled it as well yet I am still getting this error.
Is there any other settings i can clear. I can't find this error anywhere online.
Just add below code in setting.json in VS Code
"phpfmt.php_bin": "C:/xampp/php/php.exe"
in my case the location is in xampp so just add your php.exe location.
On Mac Os:
In the vscode settings (JSON view) extend the ^^ above option with the Mac Os PHP path:
"phpfmt.php_bin": "/usr/bin/php"
Cheers
assuming you have PHP installed:
Edit your vscode settings (JSON view) add this option:
"phpfmt.php_bin": "php"
If you want auto formatting on save:
All Languages:
"editor.formatOnSave": true
Just PHP:
"[php]": { "editor.formatOnSave": true }
you can always check out the plugin page too:
https://marketplace.visualstudio.com/items?itemName=kokororin.vscode-phpfmt
has this bits of info on this + further configuration
happy coding!
You have to find dir to file php.exe and then you can fig that easily by this way below:
"phpfmt.php_bin": "F:/Xampp/php/php.exe",
F:/Xampp/php/php.exe - my directory
"phpfmt.php_bin": "C:/xampp/php/php.exe"
open setting.json in VS code
You have to find your php.exe path and paste it after "phpfmt.php_bin": "php.exe path"

Getting phpunit-exported selenium IDE files to run in WebDriver

I have created a number of selenium IDE files that I converted to phpunit format in Firefox IDE 2.9.1.1 (on a Windows box), using Options -> Format converter. Those converted files define a class "Example" that is derived from class PHPUnit_Extensions_SeleniumTestCase. I now know that this class needs to be changed to PHPUnit_Extensions_Selenium2TestCase. The problem is, I cannot get this to run with recent versions of phpunit.
I am running these tests on a Fedora 24 VM which is using php 5.6.30, java 1.8.0_121-b14, and firefox 51.0.1-2. I have tried to get these to run using selenium standalone server 3.0.1 (and now 3.1.0), and phpunit 5.7.13. I have the latest php facebook WebDriver installed. The error I keep getting is that the above mentioned class is not found. I did a grep on that class and this is what I found:
[root#localhost bin]# grep -r "PHPUnit_Extensions_Selenium2TestCase" .
Binary file ./phpunit/phpunit-4.6.7.phar matches
Binary file ./phpunit/phpunit-4.7.6.phar matches
So, it appears that this class does not exist in phpunit 5.7 and above (which are in that directory), nor does it exist in html-runner.phar, which is in the same directory. The seleniumhq.org site says to use html runner if you convert from IDE, but I can find no examples of how to use the html-runner.phar file (and no documentation).
Can someone please tell me what I should change the class name to, to get this test to work?
UPDATE:
I now know that if I want to use phpunit and selenium server to drive a firefox browser, I have to get selenium talking to geckodriver. I have installed:
geckodriver 0.14.0 at /usr/local/bin/geckodriver
selenium server 3.0.1 at /usr/local/bin/selenium
phpunit-5.7.13.phar installed at /usr/local/bin/phpunit
I used composer to add webdrivers (facebook 1.3.0 :
[root#localhost composer]# cat composer.json
{
"require": {
"facebook/webdriver": "^1.3",
"phpunit/phpunit": ">=3.7",
"phpunit/phpunit-selenium": ">=1.2"
}
}
php composer.phar install
They were added to the PATH:
[bjt#localhost projects]$ echo $PATH
/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/usr/local/bin/selenium:/usr/local/bin/phpunit:/usr/local/bin/composer:/usr/local/bin/geckodriver
I have a small test file:
?php
require_once('/usr/local/bin/composer/vendor/autoload.php');
class test extends PHPUnit_Extensions_Selenium2TestCase
{
protected function setUp()
{
$this->setBrowser("*firefox");
$this->setBrowserUrl("https://fakeurl.com/");
}
public function testMyTestCase()
{
$this->open("/");
}
}
Starting the selenium server:
java -jar /usr/local/bin/selenium/selenium-standalone-3.0.1.jar
When I run the test:
/usr/local/bin/phpunit/phpunit-5.7.13.phar --verbose test.php
Yields this error:
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: The best matching driver provider Firefox/Marionette driver can't create a new driver instance for Capabilities [{browserName=*firefox}]
So, it appears that geckodriver is not talking to selenium server. If I try to force the issue by changing the execution of the server:
java -Dwebdriver.gecko.driver="/usr/local/bin/geckodriver/geckodriver" -jar /usr/local/bin/selenium-server-standalone-3.0.1.jar
or
sudo java -Dwebdriver.gecko.driver="/usr/local/bin/geckodriver/geckodriver" -jar /usr/local/bin/selenium-server-standalone-3.0.1.jar
It makes no difference. I'm hoping someone can point out what I am missing. I'm at a dead end.
I am currently working through the same process of getting this to work and would like to point out a few things:
htmlrunner is meant to run the test cases saved directly from the Selenium IDE in the default format, which is html.
Make sure you can run firefox from the terminal running the selenium server.
You added two different selenium php bindings. The facebook one and the phpunit-selenium. I currently have it working with only the facebook binding and phpunit extending the class PHPUnit_Framework_TestCase. I would recommend using the example provided within github for facebook/webdriver without phpunit to verify that your selenium config is working, then add phpunit.

Trying to run heroku locally and get a error 'vendor' is not a command

I am trying to run heroku locally using the command
heroku local
However, it returns:
[OKAY] Loaded ENV .env File as KEY=VALUE Format
'vendor' is not recognized as an internal or external command, operable program or batch file.
[DONE] Killing all proccess with signal null
Exited with exit code 1
I am using Heroku PHP within Windows 7
In my PATH environmental variable, I have both:
./vendor/bin and C:\Users\user-name\AppData\Roaming\Composer\vendor\bin
(The last one is an empty folder)
I searched for anything similar but I couldn't find.
Any thoughts on it?
Thanks in advance
Update
The error was in my Procfile:
web: vendor/bin/heroku-php-apache2 public/
Then I change all slashes to backslashes ():
web: vendor\bin\heroku-php-apache2 public\
Now its working but I am getting this error:
../heroku/heroku-buildpack-php/bin/heroku-php-apache2: line 196: php-fpm: command not found
This program requires PHP 5.5.11 or newer; check your 'php-fpm' command.
I think there is something wrong related to my composer.
The source file for heroku-php-apache2 can be found here.
The line 196 is presented below.
196: { php-fpm -n -v | php -n -r 'exit((int)version_compare(preg_replace("#PHP (\S+) \(fpm-fcgi\).+$#sm", "\\1", file_get_contents("php://stdin")), "5.5.11", "<"));'; } || { echo "This program requires PHP 5.5.11 or newer; check your 'php-fpm' command." >&2; exit 1; }
My composer.json file is:
{
"require" : {
"ext-mcrypt": "*",
"facebook/php-sdk-v4" : "~5.0",
"google/apiclient": "2.0"
},
"require-dev": {
"mashape/unirest-php": "3.*",
"heroku/heroku-buildpack-php": "*"
}
}
I tried to specific require php in composer.json but it didn't changed. Any thoughts on that?
Thank you in advance.
Years later, I've faced this same issue.
Fixed by removing vendor/ and running composer install again.
Then I've faced the same php-fpm error and to fix that I created a symbolic link from /usr/sbin/php-fpm7.4 -> /usr/sbin/php-fpm.
Hope that becomes helpful to orthers in the future!

PHPUNIT error when running tests with PHPSTORM

Running phpunit tests using PhpStorm.
Receiving this error:
/usr/local/php5/bin/php
/private/var/folders/m8/k61mmmmj7g732j3pd0_91s0c0000gn/T/ide-phpunit.php
--configuration /Users/psteinheuser/unity/test/phpunit.xml DatabaseDumperTest
/Users/psteinheuser/unity/test/DatabaseDumperTest.inc Testing started
at 11:36 AM ...
Fatal error: Class IDE_PHPUnit_Framework_TestListener contains 1
abstract method and must therefore be declared abstract or implement
the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest)
in
/private/var/folders/m8/k61mmmmj7g732j3pd0_91s0c0000gn/T/ide-phpunit.php
on line 504
Call Stack:
0.0013 340096 1. {main}() /private/var/folders/m8/k61mmmmj7g732j3pd0_91s0c0000gn/T/ide-phpunit.php:0
PHP Fatal error: Class IDE_PHPUnit_Framework_TestListener contains 1
abstract method and must therefore be declared abstract or implement
the remaining methods (PHPUnit_Framework_TestListener::addRiskyTest)
in
/private/var/folders/m8/k61mmmmj7g732j3pd0_91s0c0000gn/T/ide-phpunit.php
on line 504
Have found previous posts which have said this is fixed, though I seem to have the correct versions where it should work.
PHPStorm 7.1.3
phpunit 3.7.28
php 5.4.24
The OS is Mac 10.9.2
Have removed and re-installed PHPStorm, upgraded php, re-installed phpunit, restarted apache, rebooted, scratched my head, etc.
Running the phpunit tests manually from the terminal, works fine.
Looking at Preferences within PHpStorm, it seems to be pointing to phpunit correctly.
I'm thinking it's a permission or path issue, but I don't know where to look next.
Appreciate any input or direction.
In PHPStorm, the only way I was able to solve this was by manually updating the contents of the jar file where this error exists.
We're both on Mac OSX 10.9, so these instructions should work for you.
Begin by making a copy of the existing jar file:
cp /Applications/PhpStorm.app/plugins/php/lib/php.jar /Applications/PhpStorm.app/plugins/php/lib/php.jar.orig
Now, create a temporary directory to hold your jar file's contents and extract
mkdir ~/jarfiles
cd ~/jarfiles
jar xf /Applications/PhpStorm.app/plugins/php/lib/php.jar
Once extracted, you'll need to edit the phpunit.php file to add the missing method stub
vi scripts/phpunit.php
Around line 310 in my file is a class 'IDE_PHPUnit_Framework_TestListener'. Insert the following method stub:
public function addRiskyTest(PHPUnit_Framework_Test $test, Exception $e, $time){}
Now just re-pack your jar and replace it into your PhpStorm:
jar cf0 php.jar ./*
mv php.jar /Applications/PhpStorm.app/plugins/php/lib/php.jar
That fixed it for me. Hope it fixes it for you too. Good luck!

phpunit with composer not working

Background: i am on a windows host and sshing into a vagrant LAMP setup (ubuntu 13.04).
I have installed phpunit with composer using the following line in my composer.json:
"require-dev": {
"phpunit/phpunit": "3.7.*"
}
I have then run composer update which installed phpunit. I can now navigate to /vendor/bin and see phpunit binary.
However if i type phpunit from within that directory (or anywhere elese for that matter) I get the error "phpunit is not installed"
Any suggestions as to where I go next with this - there are so few steps involved in this setup I really cant see where I could have gone wrong
So I had this issue too, for me the fix was to change in my vagrant file:
config.vm.synced_folder "C:/dev/vm/share", "/var/www/", mount_options: ['dmode=777','fmode=666']
to
config.vm.synced_folder "C:/dev/vm/share", "/var/www/", mount_options: ['dmode=777','fmode=777']
There is a lot of advise saying 666 is permissive enough, but in my case it was not and as this is only a development machine the security implications are not too important.
./phpunit from the bin directory.
It's just not in your path.
I created the script above:
#!/bin/bash
binary=$1
shift
dir=$PWD
for i in $( seq 5 )
do
if [ -e "$dir/composer.json" ]
then
$dir/vendor/bin/$binary $#
else
echo "not found phpunit in $dir"
fi
dir="$dir/.."
done
If you name it 'composer.exec', and put it n your path, you can call it:
composer.exec phpunit [phpunit-options]
And there is it! Calling phpunit or any other bin contained in vendor/bin.

Categories