Symfony/Codeception Run Errors - symfony

I have a Symfony 2.4.4 site with simple Codeception (2.1.7) acceptance tests setup. When running the acceptance tests I get the following error:
[Codeception\Exception\ConfigurationException]
AcceptanceTester class doesn't exist in suite folder.
Run the 'build' command to generate it
The AcceptanceTester class does exist in the tests/acceptance directory. If I run a build I get the following error:
[Codeception\Exception\ConfigurationException]
Configuration file could not be found.
Run `bootstrap` to initialize Codeception.
The codeception.yml file does exist and contains the following:
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: false
memory_limit: 1024M
coverage:
enabled: true
remote: true
include:
- app/*
exclude:
- app/cache/*
include:
...
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
If I run a bootstrap it confirms this:
Project is already initialized in '.'
acceptance.suite.yml contains:
class_name: AcceptanceTester
modules:
enabled:
- AcceptanceHelper
Any suggestions?

AcceptanceTester.php file should be in tests/_support directory.
Run codecept build to regenerate Tester files.
You have no modules enabled acceptance.suite.yml.
You have to enable one of Symfony2, PhpBrowser and WebDriver.
Your site uses an old version of Symfony and it can cause issues for Codeception if Symfony2 module is used, so I recommend to test it using PhpBrowser or WebDriver.

I believe, you need to run command codecept bootstrap.

I had this problem, and I realise that I ran the codecept bootstrap but the vendor and the tests folders were in a wrong directory.
I followed this video and it helped me.

Related

AWS Lambda, adding firebase module and its dependencies to function for use with Angular Universal

I have an Angular Universal project deploying to AWS Lambda with SSR but I haven't managed to get firebase to work as a dependency with it. All the errors in the console are related to the firebase dependency & its dependencies.
Method #1: Include firebase module
package:
exclude:
- '!node_modules/firebase/**'
This adds firebase and now the errors moves to being unable to find dependencies of firebase and so on.
Method #2: Just include all node modules
This is an Angular project and I have 600mb+ of dependencies that build the app,
Method #3: Installing firebase inside my Angular 'dist' folder.
This will throw a runtime error:
Error: Failed to load gRPC binary module because it was not installed for the current system\nExpected directory: node-v64-linux-x64-glibc\nFound: [node-v64-win32-x64-unknown]\nThis problem can often be fixed by running \"npm rebuild\" on the current system\nOriginal error: Cannot find module '/var/task/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node'",
Method #4: serverless-webpack
This will throw error during sls deploy saying it can't find webpack config, but it's right there in the root directory next to the serverlesss.yml and it's already used by angular universal, I can't overwrite it with different configs for serverless-webpack plugin.
Method #5: Manual Lambda Layer
I have tried making a layer with a package.json that has firebase as a dependency, ran npm install, made an archive of the nodejs folder that has the node_modules folder and uploaded it as a layer + manually added to my function.
Same error as #1, can't find the firebase module, this would also be overwritten by the serverless framework on my next deploy.
Method #6: Lambda layer via serverless
I've tried to piece these articles together to get something working Article 1, Article 2, Article 3 and used the example from this github but switched moment with firebase.
But none of them worked, the serverless config:
layers:
firebaseLayer:
path: ../layers/firebase-layer
compatibleRuntimes:
- nodejs8.10
- nodejs10.x
package:
include:
- node_modules/**
Would throw: No file matches include / exclude patterns
I also have const firebase = require('firebase'); inside my endpoint handler.
I've been trying to get this working for two whole days and it has been beyond frustrating. Any help is appreciated.
Two possible solutions:
Use serverless-webpack with the following configuration:
# serverless.yaml
service: serverless-webpack-firebase
provider:
name: aws
runtime: nodejs10.x
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'us-east-1'}
plugins:
- serverless-webpack
package:
individually: true
custom:
webpack:
webpackConfig: "webpack.config.js"
includeModules: true
packager: "yarn"
functions:
withWebpack:
handler: handler.hello
// webpack.config.js
const path = require("path");
const slsw = require("serverless-webpack");
const nodeExternals = require("webpack-node-externals");
module.exports = {
entry: slsw.lib.entries,
target: "node",
mode: slsw.lib.webpack.isLocal ? "development" : "production",
performance: {
hints: false
},
resolve: {
extensions: [".js", ".json"]
},
externals: [nodeExternals()]
};
externals: [nodeExternals()] will remove all external dependencies from the bundle and includeModules: true will still add them to the zip under node_modules
Use a Lambda layer:
# layer yaml
service: firebase-layer
provider:
name: aws
runtime: nodejs8.10
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'us-east-1'}
layers:
firebase:
path: ./layer
description: Layer with all the required dependencies to use firebase
compatibleRuntimes:
- nodejs8.10
- nodejs10.x
licenseInfo: MIT
retain: true
and
service: serverless-layer-firebase
provider:
name: aws
runtime: nodejs10.x
stage: ${opt:stage, 'dev'}
region: ${opt:region, 'us-east-1'}
plugins:
- serverless-webpack
- serverless-pseudo-parameters
package:
individually: true
custom:
webpack:
webpackConfig: "webpack.config.js"
includeModules: false
packager: "yarn"
functions:
withLayer:
handler: handler.hello
layers:
- arn:aws:lambda:${self:provider.region}:#{AWS::AccountId}:layer:firebase:1
Same webpack.config.js, but this time with includeModules: false as we don't need the dependencies in the zip file (they are loaded with the layer).
Layer structure:
Repository is available here: https://github.com/erezrokah/serverless-webpack-firebase
See the differences in package size:

Codeception - empty coverage in second level deep folders

I'm using codeception along with a Phalcon framework project.
My structure is :
app/
business/
pro/
PricingManager.php
ProductManager.php
/!\ Codeception coverage never seems to achieve the pro directory.
coverage:
enabled: true
include:
- app/*
exclude:
- app/cache/*
The result is :
\Business::Business\ProductManager
Methods: 100.00% ( 6/ 6) Lines: 100.00% ( 22/ 22)
I even tried with
include:
- app/business/pro/*
In that case, no coverage at all.
PricingManager is never covered. PricingManager's namespace is Business\Pro, but I don't think this is the problem.
If I move it to business folder, everything is working just fine. But the problem keeps on happening everywhere in my project anyway (ex : models/ folder is covered but not models/accouting/, models/repositories/, etc)
Thanks for your help.
FYI, the command I run :
codecept run unit --env dev-unit managers/ --coverage

Codeception error: Log path is not defined by key "paths: _logs"

I've just installed Codeception (using Composer) with Symfony 2.3 in a Vagrant box running on Windows 8.1. When I try to run tests using bin/codecept run or bin/codecept run acceptance, I get this error:
Log path is not defined by key "paths: _logs"
I do have a tests/_logs folder present. The codeception.yml is posted below. The weird thing is, when I change the name of _logs folder to anything else (for example 'log'), with a corresponding change to the "log" parameter in codeception.yml, I still get the same error message that refers to "_logs". Even if I delete the _logs directory and/or remove the reference to it in codeception.yml, I get the same error message. I tried reinstalling Codeception, restarting Vagrant, rebooting the computer, and still getting the same error.
My two teammates are able to run tests with the same code and with the same Vagrant box with no problems. The difference is that one of them is using a Mac OS and the other one is using a PC with Linux. Could this problem be related to Windows?
Here's my codeception.yml file:
paths:
tests: tests
log: tests/_logs
data: tests/_data
helpers: tests/_helpers
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
colors: true
memory_limit: 1024M
log: true
modules:
config:
Db:
dsn: 'mysql:dbname=s2_at_test;host=127.0.0.1'
user: 's2_at_test'
password: #hidden#
dump: tests/_data/dump.sql
populate: true
cleanup: true

Configuration issue in behat

I use behat v3.0.15 and i want to put my features in the ./app/features reposistory.
As i can read in the documentation http://docs.behat.org/en/v3.0/guides/6.profiles.html#custom-autoloading all i have to do is to add theses lines in my behat.yml file
# behat.yml
default:
autoload:
'': %paths.base%/app/features/bootstrap
Sadly it doesn't work
When i try to init behat with this command ./bin/behat --config ./app/config/behat.yml --init, the program creates a features folder under the config folder.
So what can i do?
You've configured autoloader. Location of features is configured in paths section.
default:
autoload: %paths.base%/app/features/bootstrap
suites:
default:
paths:
- %paths.base%/app/features
Configuration of paths and autoloader is documented on different pages, so it's confusing. Behat 2.5 documentation is little better (but yaml structure is different).
Example is taken from feature test for custom paths
This is how you can define your customized php featureContext files:
autoload:
'': %paths.base%/features/bootstrap
suites:
default:
contexts:
-

Problems with basic usage of saltstack apache-formula

I'm new to Saltstack and I'm just trying to do some simple installs on a subset of minions. I want to include Environments so I have my file roots as:
file_roots:
base:
- /srv/salt/base
dev:
- /srv/salt/dev
qa:
- /srv/salt/qa
stage:
- /srv/salt/stage
prod:
- /srv/salt/prod
I set up the git backend:
fileserver_backend:
- git
- roots
I'm using gitfs set as:
gitfs_remotes:
- https://github.com/saltstack-formulas/postgres-formula
- https://github.com/saltstack-formulas/apache-formula
- https://github.com/saltstack-formulas/memcached-formula
- https://github.com/saltstack-formulas/redis-formula
So I have the master set up and I add top.sls to /srv/salt/stage with
include:
- apache
stage:
'stage01*':
- apache
But I get an error when I execute
salt -l debug \* state.highstate test=True
Error
stage01.example.net:
Data failed to compile:
----------
No matching sls found for 'apache' in env 'stage'
I've tried many ways and the master just can't seem to find the apache formula I configured for it.
I found the answer and it was sitting in the Saltstack docs the whole time.
First you will need to fork the current repository such as postgres-formula.
Depending on the environment create a branch of the same name in your newly create fork of the repo.
So for example I wanted to use postgres in my stage environment. So it wouldn't work until I created a branch named stage ined my forked repo of postgres-formula then it worked like a charm.

Resources