I got a working setup of phpunit (5.7.23) and selenium standalone web driver (3.7.1) with ChromeDriver (2.29.461571) where I can run tests on.
Sadly I run into the issue that the moveTo-command does not take any effect. So that some Buttons could be found but they are not clickable by the error f.e.
"Element is not clickable at point (46, 633)"
With "does not take any effect" means that when I look at the screenshots I made, the viewport is the same as on start.
Example
($this inherits from PHPUnit_Extensions_Selenium2TestCase)
I am looking for the logout-Button which is an <a>-Tag. On the second line I want to move there.
$logout_link = $this->byId('nav-logout');
$this->moveto($logout_link);
I already tried the moveto-command with offset-settings -- also without any effect
I went down to selenium-standalone 3.6 and now it works ... maybe a bug in the new version.
Related
Few weeks ago I set up a Message system with Symfony Messenger and it worked great.
Today I wanted to create new object through message, so I went to my server and type the command to consume message
First I had this result
$ bin/console messenger:consume-messages amqp_notifications
/usr/bin/env: ‘php\r’: No such file or directory
It never happened before with my files, and I never changed the line ending or encoding of my file sin PHPstorm.
I tried to use $ php bin/console messenger:consume-messages amqp_notifications
but then I had this error.
Attempted to load class "AMQPConnection" from the global namespace.
Did you forget a "use" statement?
Pretty weird, because I have have the php-amqp ext installed as you can see on the screenshot of my phpinfo
I didn't change anything in my Message class or Handler.
Also, I tried to call new AMQPConnection() on a random action, just to try, and I didn't get the error.
I'm completely lost with this error this time, as everything is installed.
I use PHP 7.3.1 and symfony Messenger 4.2.2
It seems your second issue was already solved by ccKep on his comment.
The first one is that the specific shebang line #!/usr/bin/env php executes the first php found in the $PATH. So if you already have uninstalled it, which seems the case, or it has a symbolic link to another php version, you can get a wrong result.
Tries to check what is inside the $PATH and replace the PHP path for the correct one. You might get the place running which php.
I have noticed that writing in Laravel's Controller:
dd($array)
outputs an un-structured view of array in Chrome Developer Tools (chome 61.0.3163.91 64-bit, MAC OS).
before it was something like this (at least it seems to me that it was like this):
Do I have 'false memories'?
OR, if dd() really outputted structured arrays in devtools, how do I bring it back?
I've posted the same question in official chrome bugs forum https://bugs.chromium.org/p/chromium/issues/detail?id=767386#c5
they said that it'd be corrected in Chrome 62 released on 17-OCT-2017, which is... TODAY:)
I'm using Chrome Version 63.0.3239.132 (Official Build) (64-bit) and still have the issue.
Workaround until the bug is fixed.
http_response_code(500);
dd('foo');
Turn it into a helper function ddd
1) Create a file called helpers.php in app/Http
2) Past the following in:
<?php
function ddd(...$args){
http_response_code(500);
call_user_func_array('dd', $args);
}
3) In composer.json, in the autoload section, add "files": ["app/Http/helpers.php"]
4) Run composer dump-autoload command in terminal
I am very new to NetBeans and I just wanted to run a Code Coverage teston my code developed earlier. I do not know what I am doing wrong.
I am using NetBeans 7.3.1 with Wamp Server 2.4, installed PHPUnit and Skeleton Generator through PEAR, and set those files in NetBeans settings.
I made the project using an existing sources. Running in my browser seems OK. I can even debug with XDebug.
But when I right click on the project name and "Test", it says "No tests executed.(0.0 s)" in the Test Result window, and this in the Output window:
PHPUnit 3.7.23 by Sebastian Bergmann.
Configuration read from C:\wamp\www\test\configuration.xml
Time: 141 ms, Memory: 2.00Mb
No tests executed!
Generating code coverage report in Clover XML format ... done
I tried running test on a PHP file, it returns an information dialog box "Test file for the selected source file was not found."
I right clicked on the PHP file, and selected "Tools->Create PHPUnit tests", it returns a warning dialog box "Tests were not generated for the following files: (file name) Review the log in Output Window." but nothing was changed in the Output window.
I generated PHPUnit Bootstrap and XML Configuration, but they did not help.
I wished I can provide screenshots, but I cannot. I am trying to be specific as possible.
I appreciate any help.
I got this error too.. I also got this in the Output tab
Fatal error: Class 'package\path\Tests\TestCase' not found in project\path\package\path\Tests\ClientTest.php on line 25
Here, TestCase is the subclass of PHPUnit_Framework_TestCase and that, along with the current test file is in a different directory structure than the source files. So, in my case, it was a path issue.
Something I noted is I need to add a bootstrap file to include files in the test path and the source path to the runtime.
This bootstrap could be generated by NetBeans. See instructions here: https://netbeans.org/kb/docs/php/phpunit.html#project-specific-configurations
I of course, had another bootstrap.php (added by another developer). I only had to link the bootstrap like follows,
Good luck!
PHPUnits message:
No tests executed!
just means that no tests were found. This can have multiple reasons:
First of all, if there are no tests, no tests are executed.
But it is also possible that there are tests, but the configuration says to skip those (for example some tests are grouped into a group named slow and the configuration XML says to exclude slow from being run).
For your case this most certainly is a configuration issue. I'm not fluent with Netbeans but as you can successfully execute PHPUnit already, that part of your setup looks working.
Next step is to find out when you invoke the test-runner where it looks for tests. It might just be that the tests directory is missing or not specified. E.g. check which configuration is in configuration.xml for example and compare that with the documentation to double-check all settings.
This is not a very concrete answer and somebody who is more fluent with Netbeans might help more, however as you'er not showing further screenshots, this is my honest best bet how to go on with trouble-shooting and why.
Seems I am getting closer to the solution. I found out the problem is not in the configurations, but in the code itself.
I do not know if this is a silly problem, but seems the test only accepts PHP codes written in OOP. I tried making another file with a class and I can make test file out of it with no problem. At least I can see the test result changes from "No test executed" to "No test passed, 1 test skipped"
My codes are written for months without OOP and I know nothing about it at all. Does this mean I have to rewrite all of them again?
It will happen when you put an assertion in a constructor of your test class and this assertion fails.
Then you will see only the warning 'No tests executed!' (not very helpful) but i suppose one should not put assertions in the constructors (this is in phpunit 4.1~).
for it was because my test names were not starting with 'test'
I'm trying to use the template from http://jenkins-php.org in my installation of Jenkins. As soon as I go in to configure the project I get a grey screen appearing and the words 'Loading'
If I look in the Browser error console I get TypeError: 'undefined' is not an object (evaluating 'registry.get')
Has anyone else experienced this problem? How can this be fixed?
We had this problem when upgraded to 1.528.
Digging further, we found out that the problem is originated from one of the client-side script files called "hudson-behavior.js" and is caused by the "Publish Over SSH" plugin. There have been other plugins that have caused this in the past, as well. We couldn't disable the plugin anyway. So we searched further.
Long story short, we ended up changing the script for the time being. If you, like us, install Jenkins using the war file, then the script file is probably extracted and cached in "/var/cache/jenkins/war/scripts/hudson-behavior.js".
The following change we made was in a function called "registerValidator":
if (depends==null) { // legacy behaviour where checkUrl is a JavaScript
try {
return eval(url); // need access to 'this', so no 'geval'
} catch (e) {
// set depends to an empty array.
depends = [];
}
}
var q = qs(this).addThis();
The URL may not always be valid. Thus, a try-catch is in order. Hope this helps!
I've just had the same issue, I'm using version 1.523 of Jenkins on an Ubuntu server.
The solution I found was to manually edit the project config.xml file.
sudo vim /var/lib/jenkins/jobs/yourProjectName/config.xml
I had images in the description and I removed those leaving the description tag empty.
I also had an empty plot section which I removed completely from the publishers section.
After saving the config and going back to 'manage Jenkins' and then 'Reload Configuration from Disk' I then reopend my project and the config opened normally again.
I wasn't getting quite the same error message as you in the browser console to start with, but I hope that helps.
I too downgraded to 1.523 and then it worked... So it's obviously some bug introduced after 1.524.
Upgrading from 1.530 to 1.531 fixed it for me.
EDIT 3: Solved. See below.
EDIT 2: I think Chadwick's on the right track with his comment. Hudson/PHPUnit is taking the localhost (the Hudson workspace) AND my local file structure and using both to run the unit tests. So it's redeclaring everything that was already declared. Why is this happening and how can I change it?
I've since reported this issue on Hudson's JIRA Server. If I get a resolution there, I'll post here. Otherwise, any help would be appreciated since my builds are going nowhere now.
My build keeps failing and I can't for the life of me understand why. Here's what I get back.
phpunit:
[exec] PHP Fatal error: Cannot redeclare generate_options() (previously declared in
<http://localhost:8080/job/Goals/ws/Goals/includes/functions/registration_fns.php>:5) in /Users
/joshsmith/Sites/Goals/Goals/includes/functions/registration_fns.php on line 32
But this particular function starts at line 5 and ends at line 32! So what in the world is going on here?
And just so you know PHPUnit works on its own outside of Hudson. Here's my terminal output from a successful test run:
Macintosh:goals joshsmith$ phpunit alltests.class
PHPUnit 3.4.14 by Sebastian Bergmann.
.............................
Time: 14 seconds, Memory: 9.75Mb
OK (29 tests, 67 assertions)
Can anyone help me figure this craziness out?
EDIT: Under Chadwick's suggestion, I tried renaming the function in case it were trying to redeclare a function internal to Hudson. This didn't work, and is clearly some other obscure issue.
This has been solved. It was an issue where I had hardcoded the paths in a single initializer file. As a result, they were being redeclared by PHPUnit.
It sounds like generate_options() is declared both in your registration_fns.php file and in some file by Hudson. PHP function names are global, so this is an inherent risk of combining code from a third party.
One way around it is to rename one of the functions (and of course all calls to it) - you can modify the Hudson code where it is declared, or modify your own, but personally I recommend changing your own. Should you upgrade Hudson in the future, you'd likely have to modify it again.
Since PHP 5.3, you also have the option of using namespaces.