Vagrant : phpUnit not found (symfony 2.8) - phpunit

I'm new to phpUnit. I installed it via composer. My composer.json is the following :
"require": {
"php": ">=5.5.9",
"symfony/symfony": "^2.8",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "^2.0",
"doctrine/mongodb-odm": "~1.0",
"doctrine/mongodb-odm-bundle": "~3.0",
"nicmart/tree": "~0.2",
"jms/serializer-bundle": "^1.1",
"simple-bus/symfony-bridge": "^4.1",
"phpunit/phpunit":">=4.2",
"codeception/codeception": "*",
"nicolopignatelli/valueobjects": "^4.0"
},
"require-dev": {
"sensio/generator-bundle": "^3.0",
"symfony/phpunit-bridge": "^2.7"
}
during composer update, i recieved
- Installing phpunit/phpunit (5.2.9)
and i see the phpunit directory in my vendors.
now while simply trying to output the phpunit version (or while trying to start testing), i get the following error message :
me#myMachine:root/path/of/symfony$ phpunit -v
The program 'phpunit' is currently not installed. To run 'phpunit' please ask your administrator to install the package 'phpunit'
is there any kind of shortcut to create in bash?
UPDATE
like suggested by the 2 current answers, i tried to run me#myMachine:root/path/of/symfony$ ./vendor/bin/phpunit -v
but it returns a permission denied exception despite the fact the current user (me#myMachine) is the fileowner.
furthermore, me#myMachine:root/path/of/symfony$ ls -l ./vendor/bin returns
-rw-rw-rw- 1 me me 612 Mar 1 09:52 codecept
-rw-rw-rw- 1 me me 603 Jan 28 13:50 doctrine
-rw-rw-rw- 1 me me 609 Jan 28 13:50 doctrine-dbal
-rw-rw-rw- 1 me me 607 Jan 28 13:50 doctrine.php
-rw-rw-rw- 1 me me 608 Feb 24 19:20 geotools
-rw-rw-rw- 1 me me 603 Mar 1 09:52 phpunit
-rw-rw-rw- 1 me me 978 Jan 20 12:15 security-checker
and if try to chmod -vR u+x ./vendor/bin it returns as expected a
mode of ‘bin/’ changed from 0777 (rwxrwxrwx) to 0766 (rwxrw-rw-)
mode of ‘bin/phpunit’ changed from 0666 (rw-rw-rw-) to 0766 (rwxrw-rw-)
but me#myMachine:root/path/of/symfony$ ls -l ./vendor/bin returns again
-rw-rw-rw- 1 me me 612 Mar 1 09:52 codecept
-rw-rw-rw- 1 me me 603 Jan 28 13:50 doctrine
-rw-rw-rw- 1 me me 609 Jan 28 13:50 doctrine-dbal
-rw-rw-rw- 1 me me 607 Jan 28 13:50 doctrine.php
-rw-rw-rw- 1 me me 608 Feb 24 19:20 geotools
-rw-rw-rw- 1 me me 603 Mar 1 09:52 phpunit
-rw-rw-rw- 1 me me 978 Jan 20 12:15 security-checker
like the chmod wasnt taken into account.
UPDATE 2
apparently, this issue is related to Vagrant.
I re-installed symfony completly, in 2.8 and 3.0 version, and the problem remains the same.
i found this similar issue and therefore choosed to install phpUnit globally composer global require phpunit/phpunit and then run phpunit -v again. This time, the command is found but i got the following error
me#myMachine:/path/to/symfony/root$ phpunit -v
PHPUnit 4.8.23 by Sebastian Bergmann and contributors.
Runtime: PHP 5.6.14-1+deb.sury.org~trusty+1
Configuration: /var/www/public/symfony/sgv3/sgv3/phpunit.xml.dist
. 1 / 1 (100%)
Time: 6.86 seconds, Memory: 27.75Mb
PHP Fatal error: Call to undefined method PHPUnit_Framework_TestResult::warningCount() in /home/vagrant/.composer/vendor/phpunit/phpunit/src/TextUI/ResultPrinter.php on line 185

If you install PHPUnit via Composer then its binary will be at vendor/bin/phpunit.

You need to call the specific binary in the vendor's bin directory of your project like
bin/phpunit -h

Related

How to build static libgpiod-tools executables for arm64?

Is there a way to build the static version of libgpiod-tools executables for arm64?
I need the static-linked version, because I need to pack them into a ramdisk for an embedded system (for debug purpose).
I can find a static version of the tools from a yocto/openbmc build result, but they are for 32-bit machines, and it seems that they can not run on arm64.
[cmic#sr223 libgpio-tools.32bit]$ ls -la
total 84
drwxr-xr-x. 2 cmic cmic 101 Apr 21 22:12 .
drwxrwxr-x. 5 cmic cmic 106 Apr 21 22:13 ..
-rwxr-xr-x. 1 cmic cmic 9652 Apr 21 22:10 gpiodetect
-rwxr-xr-x. 1 cmic cmic 9652 Apr 21 22:10 gpiofind
-rwxr-xr-x. 1 cmic cmic 9648 Apr 21 22:10 gpioget
-rwxr-xr-x. 1 cmic cmic 13748 Apr 21 22:10 gpioinfo
-rwxr-xr-x. 1 cmic cmic 13744 Apr 21 22:10 gpiomon
-rwxr-xr-x. 1 cmic cmic 13744 Apr 21 22:10 gpioset
[cmic#sr223 libgpio-tools.32bit]$ file gpiodetect
gpiodetect: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=61afc5cfee96d4a155876775f148eb9009ada03b, for GNU/Linux 3.2.0, stripped
[cmic#sr223 libgpio-tools.32bit]$ ldd gpiodetect
not a dynamic executable
[cmic#sr223 libgpio-tools.32bit]$ ./gpiodetect
-bash: ./gpiodetect: cannot execute binary file: Exec format error
Or I can download such executables from somewhere?
I would recommend you build this package from source, using the build system openbmc uses. This is the most reliable, and fastest way to add software to an image.
There is already a recipe for libgpiod-tool. Is is supported in meta-openbedded (which openbmc is based on) Here is the recipe in openbmc.
You will need to add the recipe to a openbmc machine. Try adding
IMAGE_INSTALL:append = " libgpiod-tools"
to the conf/local.conf for the machine you want to build use this on.
Then you can either build the full image or only the libgpiod pacakge
$ bitbake libgpiod
or
$ bitbake obmc-phosphor-image
Then the executable that match the aritture of the machine should be in build/tmp/work/armv7a-openbmc-linux-gnueabi/libgpiod/1.6.3-r0/packages-split/libgpiod-tools/usr/bin
You can move you new binaries over, or install a new image, to run your libgpiod-tool.
Also feel free to ask any questions you have on the openbmc discord
found here https://discord.gg/69Km47zH98, or the openbmc mailing list here https://lists.ozlabs.org/listinfo/openbmc.

TestCafe chromium test run as part of docker build

For some reason, in our CI, we need to run node tests inside docker container (including fetching dependencies, etc.). So, I am trying to have UI tests run as a part of docker build.
This is how my Dockerfile looks like:
FROM testcafe/testcafe:1.3.3
USER root
#some packages needed for some dependencies
RUN apk add --no-cache yarn python make build-base vim curl
RUN ln -s /opt/testcafe/docker/testcafe-docker.sh /usr/local/bin/testcafe-docker
WORKDIR /usr/src/app
RUN yarn config set registry https://private-npm-registry --global
COPY package*.json ./
RUN yarn
COPY . .
RUN yarn test:ui:ci
# "test:ui:clean": "rm -rf uitests/reports"
# "test:ui:ci-debug": "yarn test:ui:clean; testcafe-docker 'chromium --no-sandbox' uitests/tests -S -s uitests/reports/screenshots --video uitests/reports/videos -r spec,json:uitests/reports/report.json,html:uitests/reports/report.html",
# "test:ui:ci": "start-server-and-test serve http://127.0.0.1:8080 test:ui:ci-debug"
I get ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
Also, I tried using user user, but it gives permission error when creating reports folder inside uitests folder before running tests.
I tried it with and without the --no-sandbox option, got the same issue. Also tried chromium:headless --no-sandbox, got the same error.
Any suggestion, please? Thanks.
UPDATE:
Also tried with user: user (avoiding permission issue by using /tmp folder for report) and got same issue:
20-Jul-2019 23:53:33 > yarn test:ui:clean; whoami; ls -sail; testcafe-docker 'chromium --no-sandbox' uitests/tests -S -s /tmp/uitests/reports/screenshots --video /tmp/uitests/reports/videos -r spec,json:/tmp/uitests/reports/report.json,html:/tmp/uitests/reports/report.html
20-Jul-2019 23:53:33
20-Jul-2019 23:53:34 $ rm -rf /tmp/uitests/reports
20-Jul-2019 23:53:34 user
20-Jul-2019 23:53:34 total 528
20-Jul-2019 23:53:34 13 4 drwxr-xr-x 10 user user 4096 Jul 20 13:52 .
20-Jul-2019 23:53:34 12 4 drwxr-xr-x 8 root root 4096 Jul 20 13:52 ..
20-Jul-2019 23:53:34 79 4 -rw-r--r-- 1 root root 20 Jul 19 07:06 .dockerignore
20-Jul-2019 23:53:34 75 4 -rw-r--r-- 1 root root 45 Jul 19 07:06 .eslintignore
20-Jul-2019 23:53:34 83 4 -rw-r--r-- 1 root root 790 Jul 19 07:06 .eslintrc
20-Jul-2019 23:53:34 78 4 drwxr-xr-x 8 root root 4096 Jul 20 13:48 .git
20-Jul-2019 23:53:34 82 4 -rw-r--r-- 1 root root 326 Jul 20 13:48 .gitignore
20-Jul-2019 23:53:34 87 4 -rw-r--r-- 1 root root 189 Jul 19 07:06 Dockerfile
20-Jul-2019 23:53:34 81 4 -rw-r--r-- 1 root root 592 Jul 20 13:48 DockerfileUITest
20-Jul-2019 23:53:34 89 4 -rw-r--r-- 1 root root 451 Jul 19 07:06 README.md
20-Jul-2019 23:53:34 90 4 drwxr-xr-x 3 root root 4096 Jul 19 07:06 backend
20-Jul-2019 23:53:34 4096 4 drwxr-xr-x 3 user user 4096 Jul 20 13:53 build
20-Jul-2019 23:53:34 85 4 -rwxr-xr-x 1 root root 959 Jul 19 07:06 build.sh
20-Jul-2019 23:53:34 84 4 -rw-r--r-- 1 root root 1124 Jul 19 07:06 deploy.yaml
20-Jul-2019 23:53:34 91 4 drwxr-xr-x 1348 user user 4096 Jul 20 13:52 node_modules
20-Jul-2019 23:53:34 74 4 -rw-r--r-- 1 root root 2959 Jul 20 13:48 package.json
20-Jul-2019 23:53:34 76 4 drwxr-xr-x 2 root root 4096 Jul 19 07:06 public
20-Jul-2019 23:53:34 88 4 -rwxr-xr-x 1 root root 742 Jul 19 07:06 runUITestsInCI.sh
20-Jul-2019 23:53:34 77 4 drwxr-xr-x 8 root root 4096 Jul 19 07:06 src
20-Jul-2019 23:53:34 80 4 drwxr-xr-x 7 root root 4096 Jul 19 07:06 uitests
20-Jul-2019 23:53:34 86 448 -rw-r--r-- 1 root root 454847 Jul 20 13:48 yarn.lock
20-Jul-2019 23:53:34 Using locally installed version of TestCafe.
20-Jul-2019 23:55:36 ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
20-Jul-2019 23:55:36
20-Jul-2019 23:55:36 Type "testcafe -h" for help.
Update-2:
Tried with firefox as well and same issue: ERROR Unable to establish one or more of the specified browser connections. This can be caused by network issues or remote device failure.
Update-3:
Sorry for the delay. Got distracted in something else. Tried both in CI and local machine and it was same behaviour. Also tried suggestion in comment echo -e '#!/bin/sh\n/usr/bin/chromium-browser --no-sandbox --remote-debugging-port=9222 --headless' > /usr/local/bin/testcafe-docker and got following output in both CI and local env.
02-Dec-2019 18:45:17 DevTools listening on ws://127.0.0.1:9222/devtools/browser/711c6409-be9a-4e08-959e-0c994c8c5742
02-Dec-2019 18:45:17 [1202/074517.060637:ERROR:gl_implementation.cc(282)] Failed to load /usr/lib/chromium/swiftshader/libGLESv2.so: Error loading shared library /usr/lib/chromium/swiftshader/libGLESv2.so: No such file or directory
02-Dec-2019 18:45:17 [1202/074517.064824:ERROR:viz_main_impl.cc(176)] Exiting GPU process due to errors during initialization
02-Dec-2019 18:45:17 [1202/074517.072317:WARNING:dns_config_service_posix.cc(341)] Failed to read DnsConfig.
02-Dec-2019 18:45:17 [1202/074517.072782:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 1 time(s)
02-Dec-2019 18:45:17 [1202/074517.135149:ERROR:gl_implementation.cc(282)] Failed to load /usr/lib/chromium/swiftshader/libGLESv2.so: Error loading shared library /usr/lib/chromium/swiftshader/libGLESv2.so: No such file or directory
02-Dec-2019 18:45:17 [1202/074517.139203:ERROR:viz_main_impl.cc(176)] Exiting GPU process due to errors during initialization
02-Dec-2019 18:45:17 [1202/074517.143251:WARNING:gpu_process_host.cc(1220)] The GPU process has crashed 2 time(s)
02-Dec-2019 18:45:17 [1202/074517.208950:WARNING:gpu_process_host.cc(990)] Reinitialized the GPU process after a crash. The reported initialization time was 0 ms
02-Dec-2019 18:45:17 [1202/074517.209227:ERROR:gpu_channel_manager.cc(397)] ContextResult::kFatalFailure: Failed to create shared context for virtualization.
The recent 'Chromium' versions are not allow you to run them under the root user. Change the user from 'root' to user before running TestCafe tests.
Also, you need to setup permission for creating new folders.
See the detailed explanation in write in shared volumes docker
...
USER user
RUN yarn test:ui:ci
It is because of proxy. We use proxy to reach internet. I was adding http_proxy, https_proxy and no_proxy(127.0.0.1) in docker image. Browser in docker container was trying to reach testcafe server (running in same container) through proxy, because it does not use 127.0.0.1/localhost but 172.17.0.2as testcafe server host inside container. So adding 172.17.0.2 to no_proxy works.

post-receive /var/www/html denied

My username (let’s call it my_name) belongs to the Apache group which is owner of var/www/html directory, sub-directories and files contained within.
In that directory I installed Wordpress. Directories and files permissions are set to 0775 (yeah, I know the files should have 644, but it is not a factor for now).
Well, my username has writing permissions indeed, because I am able to create new files or directories, as well as delete them, by using SSH terminal or WinSCP.
The problem comes up when I run a post-receive hook of a bare git repository, no matter if by running the script or by pushing changes from the local working repository.
In any scenario, the post-receive hook does not work because of permission denied. Really strange and I cannot understand why.
Could you help me please?
Edit:
This is the output of ls -alrth ~/git/devsite.git/hooks directory:
-rwxrwxr-x 1 name apache 896 Apr 2 22:41 commit-msg.sample
-rwxrwxr-x 1 name apache 727 Apr 7 09:09 post-receive
-rwxrwxr-x 1 name apache 189 Apr 2 22:41 post-update.sample
-rwxrwxr-x 1 name apache 398 Apr 2 22:41 pre-applypatch.sample
-rwxrwxr-x 1 name apache 1704 Apr 2 22:41 pre-commit.sample
-rwxrwxr-x 1 name apache 1239 Apr 2 22:41 prepare-commit-msg.sample
-rw-rw-r-- 1 name apache 1348 Apr 2 22:41 pre-push.sample
-rwxrwxr-x 1 name apache 4951 Apr 2 22:41 pre-rebase.sample
-rwxrwxr-x 1 name apache 3611 Apr 2 22:41 update.sample
This is the post-receive script:
#!/bin/sh
TARGET=/var/www/html/wp-content
GIT_DIR=/home/name/git/devsite.git
#run 'post-receive' hook
git --work-tree=$TARGET --git-dir=$GIT_DIR checkout -f
Try again after a
cd /path/tp/bare/repo
git config core.sharedRepository true
I mentioned it before in "Permissions with Git Post-Receive".
In the OP's instance, the post-receive script is not placed properly: it should be in ~/git/devsite.git/hooks, not ~/git/devsite.git.

Symfony2 + SonataAdmin - assets not loading

I have Symfony 2.8 installed with Sonata Admin Bundle:
"sonata-project/admin-bundle": "2.4.*#dev",
"sonata-project/doctrine-orm-admin-bundle": "^2.3"
The Sonata admin is successfully installed and accessible at http://xxxxx.com/admin, but It can't load JS and CSS files (I get error 404). The files live in web/bundles folder:
drwxr--r-- 2 rabotnici rabotnici 4096 Dec 13 01:44 ./
drwxr-x--- 4 rabotnici nobody 4096 Dec 13 01:13 ../
lrwxrwxrwx 1 rabotnici rabotnici 91 Dec 13 01:44 framework -> /home1/rabotnici/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public/
lrwxrwxrwx 1 rabotnici rabotnici 68 Dec 13 01:44 sonataadmin -> /home1/rabotnici/vendor/sonata-project/admin-bundle/Resources/public/
lrwxrwxrwx 1 rabotnici rabotnici 67 Dec 13 01:44 sonatacore -> /home1/rabotnici/vendor/sonata-project/core-bundle/Resources/public/
Is there anything more to be configured?
When I try to open the CSS from the browser and I get error 404, here is the result of the prod.log:
No route found for "GET /bundles/sonatacore/vendor/ionicons/css/ionicons.min.css
I Found the problem in the Apache's error_log, the file .htaccess in web/bundles was with wrong permissions, I just removed it.

Cannot find module 'grunt-lib-phantomjs' in 'grunt-contrib-qunit'

I have installed phantomjs 1.9.7 wgetting the zip and then moving it to PATH in ubuntu virtualbox.
On nodejs project, firing npm install -no-bin-links goes fine, but grunt test fails with following error,
root#ubuntu1204:/home/prayagupd/vboxshared/onlywallet# grunt test
Loading "qunit.js" tasks...ERROR
>> Error: Cannot find module 'grunt-lib-phantomjs'
Warning: Task "qunit" not found. Use --force to continue.
Aborted due to warnings.
While checking grunt-contrib-quint, there's no grunt-lib-phantomjs inside node_modules,
root#ubuntu1204:/home/prayagupd/vboxshared/onlywallet# ls -l node_modules/grunt-contrib-qunit/
total 36
-rwxrwx--- 1 root vboxsf 1076 Oct 14 2012 LICENSE-MIT
-rwxrwx--- 1 root vboxsf 10267 May 27 14:11 package.json
drwxrwx--- 1 root vboxsf 4096 Jun 22 2013 phantomjs
-rwxrwx--- 1 root vboxsf 8660 Jan 17 05:25 README.md
drwxrwx--- 1 root vboxsf 4096 Oct 1 2013 tasks
root#ubuntu1204:/home/prayagupd/vboxshared/onlywallet# ls -l node_modules/grunt-contrib-qunit/phantomjs/
total 4
-rwxrwx--- 1 root vboxsf 1574 Jun 22 2013 bridge.js
However, in my local machine I've got grunt-lib-phantomjs after npm install
$ ls -l node_modules/grunt-contrib-qunit/node_modules/
total 4
drwxrwxr-x 5 prayagupd prayagupd 4096 May 27 22:00 grunt-lib-phantomjs
My package.json is,
1 {
2 "name": "zazzercode",
3 "version": "0.13.1",
4 "devDependencies": {
5 "grunt": "~0.4.1",
6 "intern": "~1.2.1",
7 "grunt-contrib-jshint": "~0.8.0",
8 "grunt-contrib-qunit": "~0.4.0",
9 "grunt-contrib-watch": "~0.5.3",
10 "grunt-contrib-uglify": "~0.3.2",
11 "grunt-contrib-concat": "~0.3.0",
12 "grunt-closure-compiler": "0.0.18"
13 },
14 "repository": {
15 "type": "git",
16 "url": "https://github.com/iPrayag/onlywallet"
17 }
18 }
There are number of issues fired at github, but none worked for me.
npm install -g grunt-contrib-qunit before npm install --no-bin-links seems to have worked.

Resources