Class not found in behat featurecontext.php - behat

after running, i am getting
Fatal error: Cannot declare class JsonApiContext because the name is already in use in C:\behat\newapi\vendor\features\bootstrap\FeatureContext.php on line 13
can anyone please help me on same ?
Thanks

If you change the extends inheritance with a different class do you still get the error message?
Have you tried with "implements" instead of "extends"?

You need to use JsonApiContext.
In your FeatureContext.php it shall look like
class FeatureContext extends JsonApiContext ....

Related

How to call a module static function from another module in PrestaShop 1.7+

I'm trying to call static function of module named: Mymodule from another module like this: Mymodule::doThis()
But got error:
Fatal error: Class 'Mymodule' not found
I know, I can use code:
include_once _PS_MODULE_DIR_.'mymodule/mymodule.php',
but I want to know if I can use class autoloading or other elegant way to achieve this
You can try this :
Mymodule::getInstanceByName('doThis');
more explanation here :
Get name of module in PrestaShop front controller

Building modified AOSP throws error (Trying to change API)

out/target/common/obj/PACKAGING/public_api.txt:4316: error 5: Added public field android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_MOVEMENT
******************************
You have tried to change the API from what has been previously approved.
To make these errors go away, you have two choices:
1) You can add "#hide" javadoc comments to the methods, etc. listed in the
errors above.
2) You can update current.txt by executing the following command:
make update-api
To submit the revised current.txt to the main Android repository,
you will need approval.
******************************
So i tried to add an #hide annotation to my member variable, but it will only give me another error:
frameworks/base/core/java/android/app/admin/DevicePolicyManager.java:233: cannot find symbol
symbol : class hide
location: class android.app.admin.DevicePolicyManager
#hide
How can I solve this problem?
I made the mistake of using #hide such as #Override, but you have to use it in a JavaDoc comment:
/**
* #hide
*/

Xtext: Customizing Error msg by unordered groups

I've defined an unordered group and it works like I expected. The only thing I would like to change is the error msg, which appears when an element of an unordered group isn't modelled yet. Is there an easy way to solve this? I tried already custom checks, but there I got an unexpected behaviour.
Following my rule for the unordered group and the error msg:
Element:
(name=ConfigurationName) &
(description=Description)? &
(tool=Tool) &
(model=Model) &
(interfaces=Interfaces)? &
(paramaters=Parameters)? &
(paramfile=ParamFile)?
;
rule ruleElement failed predicate: {getUnorderedGroupHelper().canLeave(grammarAccess.getElementAccess().getUnorderedGroup())}?
I want to change this error msg to something like: "The following elements are required in the configuration:...."
Xtext has a service called SyntaxErrorMessageProvider that is used to reword parser error messages. You have to define your messages on the parser level (so there will be no EMF model to use), but it is possible to get the original error message and the context, traverse it and provide your own error message.
To register this, open the «YourLanguage»RuntimeModule class, and add the following method:
public Class<? extends ISyntaxErrorMessageProvider> bindISyntaxErrorMessageProvider() {
return «YourLanguage»SyntaxErrorMessageProvider.class;
}
where «YourLanguage«SyntaxErrorMessageProvider is a class introduced by you, extending the class SyntaxErrorMessageProvider, where you can implement your custom function.
I works Automatic Validation customize,I create
public class MyDslLanguageSyntaxErrorMessageProvider extends SyntaxErrorMessageProvider {
}
And I Register it in the MyDslRuntimeModule:
public Class bindISyntaxErrorMessageProvider() {
return MyDslLanguageSyntaxErrorMessageProvider.class;}
But my problem is which package is used for this customization.I used org.xtext.example.mydsl.validation package for create java class .Also I do this customization with xtend class.I do not find enough source in the internet :(
You can use Java to write this Custom SyntaxErrorMessageProvider class, but to bind this you can bind in Runtime Module class. Also u can use any package to declare this class but declaring this class in same package where u have Runtime class makes sense

Yii generates error "Unable to resolve the request <controller/action>"

After logged in successfully, Yii does not executing any page.
Showing an error:
Error 404 Unable to resolve the request "membersdet/index"
Here membersdet is controller Id and index is an action.
Make sure the filename of your controller is EXACTLY "MembersdetController.php". It is case sensitive.
I guess you were developing on local machine under Windows OS and server runs on *nix system. That's normal issue for novice developers, that they forget about case sensitive file system in *nix.
It is because of wrong controller file name given or may be actionIndex() method is not in your controller.
I have had a similar problem and got it solved. In this case the file was correctly named but the class name was wrongly spelled. When these two do not correspond, you could get this error too.
Check case sensitive exactly your controller: MembersdetController
Check alias (common in config/main.php) map with namespace in your controller
Yii::setAlias('#tienn2t', dirname(dirname(__DIR__)) . '/tienn2t');
In MembersdetController.php file
<?php
namespace tienn2t\controllers;
use Yii;
use yii\web\Controller;
class MembersdetController extends Controller{
public function actionIndex(){
echo 1;die;
}
}
There is not enough information in the question, but maybe you have an incorrect .htaccess or if you don't have an htaccess at all you should use the url:
http://host/index.php?r=membersdet/index
Make sure you have MembersdetController in /protected/controllers/ and this class "is a" CController and has a public method named actionIndex().
Check errorHandler block in your config file.
I had fix this error like this
'errorHandler' => [
'errorAction' => 'error/index',
],
By the way you should have appropriate ErrorController in your module and /error/index.php
file in view folder.
Hope will help you.

Trying to use MAX(): "Fatal error: Undefined class constant"

$c = new Criteria();
$c->addSelectColumn('MAX('.Moto::matricula.')');
But i get this error:
Fatal error: Undefined class constant
'matricula' in /opt/lampp/htdocs/
prueba/lib/model/MotoPeer.php on line
25.
Any idea?
I'm using symfony 1.4 and propel 1.4.
Regards
Javi
It means that the class "Moto" doesn't have a variable "matricula" in it. This does not seem to have anything to do with (my)sql, but more with the (php?) class you are using.
Check out the source of that Moto class, and look if you have made a typo in the constant name?