Codeception Acceptance suite configuration error in Yii2 - php

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

Related

Composer won't install due to strange syntax in composer.json: "package/package": "other-package as x.xx.x"

This composer.json file won't install due to an inline alias. This line appears to be the culprit:
"jms/serializer": "xsd2php-dev as 0.18.0",
I'm not sure what this is trying to do. Is it trying to replace the jms/serializer with xsd2php-dev at version 0.18.0?
Here is the full file:
{
"require": {
"jsanc623/phpbenchtime": "dev-master",
"gte451f/phalcon-json-api-package": "dev-master",
"soundasleep/html2text": "~0.2",
"phpmailer/phpmailer": "~5.2",
"php": ">=5.2.0",
"ext-curl": "*",
"jms/serializer": "xsd2php-dev as 0.18.0",
"robmorgan/phinx": "^0.5.3",
"aws/aws-sdk-php": "^3.19"
},
"require-dev": {
"codeception/codeception": "*",
"flow/jsonpath": "dev-master",
"goetas/xsd2php": "2.*#dev",
"goetas/xsd-reader": "2.*#dev"
},
"repositories": [{
"type": "vcs",
"url": "https://github.com/goetas/serializer.git"
}]
}
Composer version 1.10.19
here is an example of my error I get:
$ composer
[UnexpectedValueException]
Invalid version string "xsd2php-dev" in "xsd2php-dev as 0.18.0", the alias source must be an exact version, if it is a branch name you should prefix it with dev-
As per #rob006:
Try change it to dev-xsd2php as 0.18.0 - non-version-like branches should be prefixed by dev, not suffixed.
"jms/serializer": "xsd2php-dev as 0.18.0",
to
"jms/serializer": "dev-xsd2php as 0.18.0",

Issue deploying to AppEngine (Flex) with specific PHP version

Since yesterday I can't deploy new versions of my PHP 5.6.* app to Google Cloud App Engine, by default is setting PHP 7.2.*
In the composer.json I do require the the correct version, this is the message
Step #0: There is no PHP runtime version specified in composer.json, or
Step #0: we don't support the version you specified. Google App Engine
Step #0: uses the latest 7.2.x version.
composer.json
{
"require": {
"php": "5.6.*",
"ext-mcrypt": "*",
"ext-imagick": "*",
"ext-mysql": "*",
"ext-zip": "*",
"ext-gd": "*",
"ext-mbstring": "*",
"ext-soap": "*",
"ext-bcmath": "*",
"ext-zip": "*",
"ext-curl": "*",
"ext-pdo_mysql": "*"
}
}
In the documentation clearly says it should be available
https://cloud.google.com/appengine/docs/flexible/php/runtime?hl=en
yaml file
runtime: php
api_version: 1
service: app-ecom-worker
env: flex
skip_files:
- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^(.*/)?Plugin(.*/)?webroot/
- ^(.*/)?queue.yaml
- ^(.*/)?ZohoReports/UploadTool/jre/lib/rt.jar
env_variables:
PARAM1: "production"
PARAM2: "10.72.0.3"
PARAM3: ebroot
PARAM4: ""
PARAM5: ebdb
PARAM6: 10.0.0.3
PARAM7: worker
CPWATCH: 0
MTNS_RPC: "x.x.x.x:8082"
MTNS_IO: "https://app.xxxx.com:843"
REDIS_LOG: 1
REDIS_LOG_DB: 2
REDIS_LOG_HOST: 10.0.0.3
REDIS_LOG_LIMIT: 50000
beta_settings:
cloud_sql_instances: fourth-carport-210916:us-east1:ecomexperts
runtime_config:
document_root: app/webroot
resources:
cpu: 2
memory_gb: 2
automatic_scaling:
min_num_instances: 1
max_num_instances: 4
cpu_utilization:
target_utilization: 0.95
Any Idea how to solve this?
You need to fix
"php": "7.2.*",
I deployed with Runtime PHP version 5.6 in App Engine Flexible and verified that the deployed version is 7.2 instead of 5.6. Alsos in the Step 0 when deploying, I saw that it was creating a Dockerfile with php72 image in place of php56 image.
It seems a bug so I created a Public Issue Tracker. You can see all the updates their related to PHP 5.6 version issue.

(PHP composer) Is there a mean to load global installed packages into local composer.json

On my computer Ubuntu, I use composer for :
local-installing packages into my project
global-installing librairies for my bash usage (phpunit, phpcs, phpmd for example)
In my project, I have a myproject/composer.json file with
"require": {
"php": ">=5.5.9",
"sensio/framework-extra-bundle": "^3.0.2",
"lib-curl": ">=7",
"ext-curl": ">=7"
},
"require-dev": {
"phpunit/phpunit": ">=6"
}
In my global ~/.composer/composer.json I already have
"require": {
"phpunit/phpunit": ">=6"
}
Is there a mean to specify in my project that the phpunit is already installed on global and having :
myproject/vendor/bin/phpunit as symnlink toward ~/.composer/vendor/bin/phpunit
myproject/vendor/autoload.php including the classes of ~/.composer/vendor/phpunit ?

Why can magento behat test not find my database?

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.

Missing extension in Behat/mink/laravel

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: ~

Categories