I am running Ubuntu 12.04.3 LTS and my php version is 5.5.9-1+sury.org~precise+1. I want to test a web page, so included in my project behat, mink and its goutte extension using composer.
When I run behat in the terminal I get the following error:
PHP Warning: require(goutte): failed to open stream: No such file or directory in /home/andreea/public_html/vendor/behat/behat/src/Behat/Behat/Extension/ExtensionManager.php on line 112
PHP Fatal error: require(): Failed opening required 'goutte' (include_path='.:/usr/share/php:/usr/share/pear') in /home/andreea/public_html/vendor/behat/behat/src/Behat/Behat/Extension/ExtensionManager.php on line 112
My composer.json file looks like this:
{
"name": "glp/glp",
"description": "My page",
"require": {
"paymill/paymill": "v3.0.0",
"behat/behat": "2.4.*#stable",
"behat/mink": "1.5.*#stable",
"behat/mink-goutte-driver": "*",
"behat/mink-extension": "*"
},
"minimum-stability": "dev",
"config": {
"bin-dir": "bin/"
}
}
And behat.yml is:
default:
paths:
features: features
bootstrap: %behat.paths.features%/bootstrap
extensions:
Behat\MinkExtension\Extension:
goutte: ~
I need some help to make it work. Thanks!
You're missing one level of indentation in front of goutte:
default:
paths:
features: features
bootstrap: %behat.paths.features%/bootstrap
extensions:
Behat\MinkExtension\Extension:
goutte: ~
Related
I am trying to setting up Codeception with Yii2 Basic framework. Unit Test's are working fine. Acceptance is also working, but if I want to use WebDriver module, I get error. This is the acceptance.suite.yml file
class_name: AcceptanceTester
modules:
enabled:
- AcceptanceHelper
- WebDriver:
url: 'http://mylocalsite'
browser: phantomjs
Phantomjs is installed and running on PORT 4444.
The error I get is:
[yii\base\ErrorException]
Illegal offset type in isset or empty
This is the composer file to give you idea about versions.
{
"config": {
"vendor-dir": "protected/vendor"
},
"require": {
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*",
"guzzlehttp/guzzle": "4.*",
"mobiledetect/mobiledetectlib" : "2.8.8",
"codeception/codeception": "2.0.16",
"codeception/specify": "*",
"codeception/verify": "*",
"yii2tech/sitemap": "*",
"geoip2/geoip2":"~2.0",
"facebook/facebook-instant-articles-sdk-php": "^1.5"
},
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-composer": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*"
},
}
Is there any wrong with the configuration file or anyone face the same issue?
The following is just an assumption and is not verified. YAML configuration in old Codeception version was slightly different, AFAIK there was an additional config section. Your composer.json shows that you manually locked to "codeception/codeception": "2.0.16".
What you could try:
Update to 2.2
using "codeception/codeception": "^2.2" in composer.json
Provide additional config section
class_name: AcceptanceTester
modules:
enabled:
- WebDriver
config:
WebDriver:
url: http://mylocalsite
browser: phantomjs
port: 4444
When I call bin/behat to execute my tests, I get this error:
test.dev bin/behat
[Zend_Db_Adapter_Exception]
SQLSTATE[HY000] [2002] No such file or directory
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
This is my composer.json:
{
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"magetest/magento-behat-extension": "dev-develop",
"magetest/magento-phpspec-extension": "~2.0",
"peridot-php/webdriver-manager": "dev-master",
"bossa/phpspec2-expect": "dev-master",
"behat/mink-extension": "*",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium2-driver": "*",
"behat/mink-selenium-driver": "*"
},
"autoload": {
"psr-0": {
"": [
"html/app",
"html/app/code/community",
"html/app/code/core",
"html/lib"
],
"Mage" : "html/app/code/core"
}
},
"config": {
"bin-dir": "bin"
}
}
And this is my behat.yml:
default:
paths:
features: features
bootstrap: features/bootstrap
extensions:
MageTest\MagentoExtension\Extension: ~
Behat\MinkExtension\Extension:
base_url: http://test.dev
goutte: ~
selenium2: ~
default_session: selenium2
It's a patchwork of several tutorials while every of them threw the same error. My Magento installation is in html under project. Only thing that differs to all tutorials is, that I have no html/app/code/local folder.
Composer install and behat --init run without errors.
Edit:
I'm working with MAMP Pro, so I found this issue. But linking the socket file to /tmp did not fix my problem.
Since I use MAMP, I have to configure it for CLI as well:
export PATH=/Applications/MAMP/bin/php/php5.6.10/bin:$PATH
Now CLI uses my MAMP PHP version and everything runs well.
I install a fresh copy of Lumen as Heroku app. Also I implemented the packange Dingo into it: https://github.com/dingo/api/ but when I try to load everything server return me this error:
2016-02-14T11:07:45.657820+00:00 app[web.1]: [14-Feb-2016 11:07:45 UTC] PHP Warning: require(/app/vendor/dingo/api/src/helpers.php): failed to open stream: No such file or directory in /app/vendor/composer/autoload_real.php on line 54
2016-02-14T11:07:45.657998+00:00 app[web.1]: [14-Feb-2016 11:07:45 UTC] PHP Fatal error: require(): Failed opening required '/app/vendor/dingo/api/src/helpers.php' (include_path='.:/app/.heroku/php/lib
/php') in /app/vendor/composer/autoload_real.php on line 54
I tried to remove vendor folder, etc and reinstall it but result is the same
EDIT: My composer.json is:
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"minimum-stability": "dev",
"require": {
"php": ">=5.5.9",
"laravel/lumen-framework": "5.2.*",
"vlucas/phpdotenv": "~2.2",
"dingo/api": "1.0.x#dev"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~4.0",
"dingo/api": "1.0.x#dev"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/",
"database/"
]
}
}
EDIT 2: I tried now in my local machine and Lumen with Dingo works correctly so it's something with Heroku sigh. How to see Lumen Logs in Heroku Logs?
I think you missed to add configuration in your Heroku App. To make your Heroku app fetching all the composer requirements, you may run this on your root of Lumen App:
heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php
Make a change again, then push your changes to heroku repository, eg:
git push heroku master
Edit
To make this works, I have my own way to deploy Lumen App to Heroku.
lumen new my-app
cd my-app
# Here you can change your composer.json dependencies
composer require dingo/api
Make your procfile
vim Procfile
# Content of Procfile
web: vendor/bin/heroku-php-apache2 public
Initialize repo
git init
git add -A .
git commit -m "[INIT] Initial commit."
Create Heroku app:
heroku create
heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php
git push heroku master
Visit your heroku app.
I'm using heroku and i'm following this tutorial here, https://devcenter.heroku.com/articles/s3-upload-php
I have placed the composer require line in my composer.json file as shown below.
{
"require" : {
"silex/silex": "~1.1",
"monolog/monolog": "~1.7"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
},
"require" : {
"aws/aws-sdk-php": "~2.6"
}
}
As you can see i placed the amazon one last. However, i'm receiving the following error message.
2015-02-27T16:26:05.499004+00:00 app[web.1]: [27-Feb-2015 16:26:05 UTC] PHP Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /app/web/fb/fileupload.php on line 4
Does anyone know if i have to do anything other than place that line in my composer json file???? please help
You now have two "require" keys, how is that supposed to work? It's a hash map, the keys overwrite each other!
This is what you want:
{
"require": {
"silex/silex": "~1.1",
"monolog/monolog": "~1.7",
"aws/aws-sdk-php": "~2.6"
},
"require-dev": {
"heroku/heroku-buildpack-php": "*"
}
}
And then you of course have to run composer update to generate a composer.lock, and check that into the repos along with the rest of your code.
Why don't you run the app locally on your computer before pushing it up to Heroku?
So looks like an include can not find vendor/autoload.php
Are you sure that it exists?
vendor folder should be in fb folder an have that file.
Remember it is case sensitive.
Just make sure that you point to proper file on an include.
Make sure you ran composer install
I'm having a lot of trouble with setting up behat + mink for my laravel project.
The error msg:
PHP Deprecated: The ability to pass file names to Yaml::parse() was deprecated in 2.7
and will be removed in 3.0. Please, pass the contents of the file instead. in
home/user/projects/php/projectname/vendor/symfony/yaml/Symfony/Component/Yaml/Yaml.php
on line 58
[Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
`Behat\MinkExtensions\Extension` extension file or class could not be located.
My composer.json:
"require": {
"laravel/framework": "4.2.*",
"behat/behat": "~3.0.6",
"behat/mink": "1.6.*",
"behat/mink-goutte-driver": "*",
"behat/mink-selenium-driver": "*",
"behat/mink-selenium2-driver": "*",
"behat/mink-sahi-driver": "*",
"behat/mink-zombie-driver": "*"
My behat.yml (located in the root of the project)
default:
extensions:
Behat\MinkExtensions\Extension:
goutte: ~
I've tried different versions, but still same error msg.
The commands I've run are:
./vendor/bin/behat --init
./vendor/bin/behat
But produces same msg.
https://github.com/Behat/MinkExtension/blob/master/doc/index.rst
Reading the above solved the problem and the behat.yml should look like this.
# behat.yml
default:
# ...
extensions:
Behat\MinkExtension:
base_url: 'http://example.com'
sessions:
default:
goutte: ~