I have Zend Server CE installed on OS X (10.7.5), I installed PHPUnit via PEAR
$ which pear
/usr/local/zend/bin/pear
$which php
/usr/local/zend/bin/php
$php -v
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
with Zend Extension Manager v6.0.0, Copyright (c) 2003-2013, by Zend Technologies
- with Zend Data Cache v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [disabled]
- with Zend Job Queue v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [enabled]
- with Zend Utils v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [enabled]
- with Zend Optimizer+ v6.0.0, Copyright (c) 1999-2013, by Zend Technologies [loaded] [licensed] [disabled]
- with Zend Code Tracing v6.0.0, Copyright (c) 2009-2013, by Zend Technologies [loaded] [licensed] [enabled]
- with Zend Monitor v6.0.0, Copyright (c) 1999-2013, by Zend Technologies [loaded] [licensed] [disabled]
- with Zend Page Cache v6.0.0, Copyright (c) 2004-2013, by Zend Technologies [loaded] [licensed] [disabled]
$ which phpunit
/usr/local/zend/bin/phpunit
But when I execute:
$ phpunit
Inside a test directory (with proper configuration and bootstrapping) I receive the following error:
/usr/local/zend/bin/phpunit: line 2: ?php: No such file or directory
/usr/local/zend/bin/phpunit: line 3: /Applications: is a directory
/usr/local/zend/bin/phpunit: line 4: Bootstrap.php: command not found
/usr/local/zend/bin/phpunit: line 5: syntax error near unexpected token `('
/usr/local/zend/bin/phpunit: line 5: ` * Copyright (c) 2001-2013, Sebastian Bergmann <sebastian#phpunit.de>.'
But if I run:
$ php /usr/local/zend/bin/phpunit
everything works.
Let me expand this a bit:
which phpdoc returns /usr/local/zend/bin/phpdoc but running phpdoc from inside a test folder returns
/usr/local/zend/bin/phpdoc: line 2: ?php: No such file or directory
/usr/local/zend/bin/phpdoc: line 3: /Applications: is a directory
/usr/local/zend/bin/phpdoc: line 4: LICENSE.txt: command not found
/usr/local/zend/bin/phpdoc: line 5: LICENSE.txt: command not found
/usr/local/zend/bin/phpdoc: line 6: LICENSE.txt: command not found
/usr/local/zend/bin/phpdoc: line 7: LICENSE.txt: command not found
/usr/local/zend/bin/phpdoc: line 8: syntax error near unexpected token `('
/usr/local/zend/bin/phpdoc: line 8: ` * #copyright 2010-2013 Mike van Riel / Naenius (http://www.naenius.com)'
Any idea why this is happening?
Related
A PHPUnit example from the online documentation is not working for me! Please see below for more details.
Your help is appreciated. Thank you in advance!
I'm trying to run the example test below from online documentation but, it is not working for me!
Example 2.7 Using a data provider that returns an Iterator object
The result I'm getting is shown below:
..#VivoBook MINGW64 ~/PHPunit/test-project
$ ./vendor/bin/phpunit --testdox dataProviders
PHPUnit 8.5.32 by Sebastian Bergmann and contributors.
Warning Test Case (PHPUnit\Framework\WarningTestCase)
⚠ Warning
│
│ The data provider specified for DataTest::testAdd is invalid.
│ Error: Class 'CsvFileIterator' not found
│ ..\PHPunit\test-project\dataProviders\DataProviderTest.php:16
│
Time: 77 ms, Memory: 4.00 MB
WARNINGS!
Tests: 1, Assertions: 0, Warnings: 1.
PHP info:
..#VivoBook MINGW64 ~/PHPunit/test-project
$ php -v
PHP 7.2.28 (cli) (built: Feb 18 2020 12:54:18) ( ZTS MSVC15 (Visual C++ 2017) x64 )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
The issue appeared because the class in use was not loaded. Loading the class 'CsvFileIterator' using require/require_once solved the issue.
I wanna to test my code and coverage. I already install Xdebug extension and when I verify with php -v command, all i'ts good like that :
PHP 7.4.12 (cli) (built: Oct 27 2020 17:18:47) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Xdebug v3.0.0RC1, Copyright (c) 2002-2020, by Derick Rethans
with Zend OPcache v7.4.12, Copyright (c), by Zend Technologies
However if I run phpunit i have a fatal error :
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.
Fatal error: Uncaught SebastianBergmann\CodeCoverage\RuntimeException: xdebug.coverage_enable=On has to be set in php.ini in C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\vendor\phpunit\php-code-coverage\src\Driver\Xdebug.php on line 42
SebastianBergmann\CodeCoverage\RuntimeException: xdebug.coverage_enable=On has to be set in php.ini in C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\vendor\phpunit\php-code-coverage\src\Driver\Xdebug.php on line 42
Call Stack:
0.0005 402112 1. {main}() C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\phpunit:0
0.0027 477240 2. require('C:\Users\quent\Desktop\Github\quentingeeraert-website\vendor\symfony\phpunit-bridge\bin\simple-phpunit.php') C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\phpunit:13
0.2824 501760 3. include('C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\phpunit') C:\Users\quent\Desktop\Github\quentingeeraert-website\vendor\symfony\phpunit-bridge\bin\simple-phpunit.php:405
0.2989 1149952 4. PHPUnit\TextUI\Command::main($exit = ???) C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\phpunit:22
0.2989 1150064 5. Symfony\Bridge\PhpUnit\Legacy\CommandForV6->run($argv = [0 => 'bin\\phpunit', 1 => '--colors=always', 2 => '--stop-on-failure'], $exit = TRUE) C:\Users\quent\Desktop\Github\quentingeeraert-website\bin\.phpunit\phpunit-7.5-0\src\TextUI\Command.php:162
I already add xdebug.coverage_enable = On in my php.ini file so I don't understand why the system say that :/
Maybe someone can help me ? Thank you a lot for help me !
I already add xdebug.coverage_enable = On in my php.ini file so I don't understand why the system say that :/
Xdebug v3.0.0RC1
PHPUnit 7.5.20
Either upgrade PHPUnit to the version that knows about Xdebug 3 ... or downgrade Xdebug to 2.x (2.9.8 is the latest).
Thing is: xdebug.coverage_enable is the Xdebug 2 option. That option does nothing in Xdebug 3 where you should use xdebug.mode = coverage instead.
Xdebug 3 uses different config options than v2 and your version of PHPUnit is simply not aware of that. Xdebug 3 will simply report an empty value/0 for no-longer-used Xdebug 2 options.
https://3.xdebug.org/docs/upgrade_guide#Changed-Configuration-Settings
P.S. You should see a warning when you run php -i with Xdebug 3 -- it should complain if such a wrong/outdated option is present in your php.ini (unless you have configured PHP to not to report any startup errors I guess).
In either case: run php -i and see the actual live values from Xdebug section: what value that option has.
I'm trying build my solution with dotnet core using cake but I receive it:
C:\Program Files\dotnet\sdk\1.0.1\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.Common.targets(73,5): error : Project 'xxx.csproj' targets '.NETCoreApp,Version=v1.1'. It cannot be referenced by a project that targets '.NETCoreApp,Version=v1.0'. [xxx.csproj]
What could be wrong?
If I run dotnet.exe build on cmd, the builds work normally
dotnet build xxx.csproj
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
CouchDB.Driver.Core -> xxx.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:01.50
Environment Machine
The xxx.csproj version is:
netcoreapp1.1
cake --version
Version 0.19.1+Branch.main.Sha.4c5b4fd5b1c4d9d36066ec78714027e26b211af4
dotnet.exe --version
1.0.1
dotnet.exe
Microsoft .NET Core Shared Framework Host
Version : 1.1.0
Build : 928f77c4bc3f49d892459992fb6e1d5542cb5e86
I forgot 2 things. The solution is:
Set correct framework in build.cake:
var settings = new DotNetCoreBuildSettings
{
Framework = "netcoreapp1.1",
Configuration = "Release",
OutputDirectory = "./build/"
};
DotNetCoreBuild("./src/", settings);
Restore NuGet packages using the DotNetCoreRestore instead nuget.exe
Task("Restore-NuGet-Packages")
.IsDependentOn("Clean")
.Does(() => {
DotNetCoreRestore("src"); // use it instead of NuGetRestore("./folder");
});
The result is:
Build
Executing task: Build
Microsoft (R) Build Engine version 15.1.548.43366
Copyright (C) Microsoft Corporation. All rights reserved.
CouchDB.Driver.Core -> xxx.dll
Build succeeded.
0 Warning(s)
0 Error(s)
Time Elapsed 00:00:11.10
Finished executing task: Build
I have installed Qt5.5.1 on Windows 8 and the compiler is MSVC2013 64 bit, now I need to integrate qwt with Qt
I am following the instruction here, as a first step downloaded qwt source and extracted it, then opened Qt5.5 64bit(MASVC 2013) command prompt and run the command
C:\Qt\Qt5.5.1\5.5\msvc2013_64\bin\qmake.exe qwt.pro
Which end with no error.
Now I open Visual studio x64 Win64 Command prompt(2010) and run
nmake
Which give following error
Setting environment for using Microsoft Visual Studio 2010 x64 tools.
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>E:
E:\>cd
E:\
E:\>cd Software\Qt\QWT\qwt-6.1.1
E:\Software\Qt\QWT\qwt-6.1.1>nmake
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
cd src\ && ( if not exist Makefile C:\Qt\Qt5.5.1\5.5\msvc2013_64\bin\qma
ke.exe E:\Software\Qt\QWT\qwt-6.1.1\src\src.pro -o Makefile ) && "C:\Program Fil
es (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\nmake.exe" -f Makefile
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64\nmake.
exe" -f Makefile.Release all
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
compiling .\qwt_abstract_scale_draw.cpp .\qwt_clipper.cpp .\qwt_color_map.cpp .\
qwt_column_symbol.cpp .\qwt_date.cpp .\qwt_date_scale_draw.cpp .\qwt_date_scale_
engine.cpp .\qwt_dyngrid_layout.cpp .\qwt_event_pattern.cpp .\qwt_graphic.cpp .\
qwt_interval.cpp .\qwt_interval_symbol.cpp .\qwt_math.cpp .\qwt_magnifier.cpp .\
qwt_null_paintdevice.cpp .\qwt_painter.cpp .\qwt_painter_command.cpp .\qwt_panne
r.cpp .\qwt_picker.cpp .\qwt_picker_machine.cpp .\qwt_pixel_matrix.cpp .\qwt_poi
nt_3d.cpp .\qwt_point_polar.cpp .\qwt_round_scale_draw.cpp .\qwt_scale_div.cpp .
\qwt_scale_draw.cpp .\qwt_scale_map.cpp .\qwt_spline.cpp .\qwt_scale_engine.cpp
.\qwt_symbol.cpp .\qwt_system_clock.cpp .\qwt_text_engine.cpp .\qwt_text_label.c
pp .\qwt_text.cpp .\qwt_transform.cpp .\qwt_widget_overlay.cpp .\qwt_curve_fitte
r.cpp .\qwt_abstract_legend.cpp .\qwt_legend.cpp .\qwt_legend_data.cpp .\qwt_leg
end_label.cpp .\qwt_plot.cpp .\qwt_plot_renderer.cpp .\qwt_plot_xml.cpp .\qwt_pl
ot_axis.cpp .\qwt_plot_curve.cpp .\qwt_plot_dict.cpp .\qwt_plot_directpainter.cp
p .\qwt_plot_grid.cpp .\qwt_plot_histogram.cpp .\qwt_plot_item.cpp .\qwt_plot_ab
stract_barchart.cpp .\qwt_plot_barchart.cpp .\qwt_plot_multi_barchart.cpp .\qwt_
plot_intervalcurve.cpp .\qwt_plot_zoneitem.cpp .\qwt_plot_tradingcurve.cpp .\qwt
_plot_spectrogram.cpp .\qwt_plot_spectrocurve.cpp .\qwt_plot_scaleitem.cpp .\qwt
_plot_legenditem.cpp .\qwt_plot_seriesitem.cpp .\qwt_plot_shapeitem.cpp .\qwt_pl
ot_marker.cpp .\qwt_plot_textlabel.cpp .\qwt_plot_layout.cpp .\qwt_plot_canvas.c
pp .\qwt_plot_panner.cpp .\qwt_plot_rasteritem.cpp .\qwt_plot_picker.cpp .\qwt_p
lot_zoomer.cpp .\qwt_plot_magnifier.cpp .\qwt_plot_rescaler.cpp .\qwt_point_mapp
er.cpp .\qwt_raster_data.cpp .\qwt_matrix_raster_data.cpp .\qwt_sampling_thread.
cpp .\qwt_series_data.cpp .\qwt_point_data.cpp .\qwt_scale_widget.cpp .\qwt_plot
_svgitem.cpp .\qwt_plot_glcanvas.cpp .\qwt_abstract_slider.cpp .\qwt_abstract_sc
ale.cpp .\qwt_arrow_button.cpp .\qwt_analog_clock.cpp .\qwt_compass.cpp .\qwt_co
mpass_rose.cpp .\qwt_counter.cpp .\qwt_dial.cpp .\qwt_dial_needle.cpp .\qwt_knob
.cpp .\qwt_slider.cpp .\qwt_thermo.cpp .\qwt_wheel.cpp
cl : Command line error D8021 : invalid numeric argument '/FS'
NMAKE : fatal error U1077: 'echo' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0
\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
E:\Software\Qt\QWT\qwt-6.1.1>
What could be the issue, my Qt using MSVC2013 64 bit compiler and where as I running nmake using visual studio 2010 command prompt. Could that be the issue?
If so do I need to install Visual studio 2013?
I also tried jom using the command
C:\Qt\Qt5.5.1\Tools\QtCreator\bin\jom.exe -j12
Which also end up with some error.
Any help will be appreciated,
Thanks
Haris
you need to open the command prompt like administrator.
And for be available to use the plugins, need to compile qwt in the same compiler that Qt Creator.
I have two servers.
On the first (local) code works properly,
on the second one (stage) I get syntax error - ofcourse checked a script file (scp & diff).
Braces are enclosed correctly.
Command used to check
php -l template.phtml
stage error
PHP Parse error: syntax error, unexpected '}' in template.phtml on line 135
Errors parsing template.phtml
135 line of file
<?php $i++; } ?>
local output for lint (tried also with second local server)
No syntax errors detected in template.phtml
stage version
PHP 5.5.3-1ubuntu2.5 (cli) (built: Jun 25 2014 17:14:14)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
local version
PHP 5.4.24 (cli) (built: Jan 19 2014 21:32:15)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
antoher local server version
PHP 5.3.10-1ubuntu3.14 with Suhosin-Patch (cli) (built: Sep 4 2014 07:08:49)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
In the stage is installed php-fpm (I'm not deal with it).
Any ideas?
Should I deal with php.ini or just reinstall php?
It looks like you're mixing PHP and HTML. Try the colon syntax for that.
Although the best practice would be to separate the PHP code from the HTML code. Something like Smarty can help with that.