Yii2 controller/action in windows scheduler - yii2

I have found a few questions and answers for this, but I can't make it work. I have a controller (extending controller), and an action. When I try this in PowerShell (as admin):
C:\wamp64\www\project\yii controller/action
a black cmd window is appearing for a moment but certainly doesn't do what it supposed to do, otherwise I could see the results what I'm waiting for. How can I check what is going on in this cmd window? Maybe there is an error message that could help me to find out what is wrong. I have tried -noexit but it's still disappearing.
If I run the controller/action in a browser, it is working.
Once it is working I guess I can add it to windows scheduler.

Try executing as
C:\wamp64\www\project\yii.bat controller/action

I have figured it out:
first, the controller has to be in project\commands. You are in your project folder in CMD and run the following command:
yii controller/action
and that's it.

Related

Pyautogui and PyDirectInput does not work on just one program

Im trying to automate a process on my job which is just creating and downloading pdf file like 1000 times but the problem is, i tried both library and both working normal on every test i made except one program that i need. Its not giving error, it looks like working but nothing happens.
I can still locate image on the screen but when i tried to send key or click to a button on program nothing happens. What can i do about this, is there any other way for this?
I tried both library with different programs but the only one i need is the only one that i get issue
I solved my problem today. There is no problem with any library, it was just because of the program that I need running as "Run as administrator" and because of that when I tried to run cmd administrator it's just working well. looks like both should be at the same level to get control over it.

Why is the type() function not executed in this script?

I am new to Sikulix and I am running into a problem.
I am trying to follow a tutorial, but the type() function does not seem to work.
I am working on a windows 10 machine 64bit, with sikulix 1.1.3 IDE.
Below is an image of my simple script in which I try to start the calculator in windows.
Both clicks are executed, but the type is not. It also doesn't show up in the log screen:
Is this a bug or am I missing something?
Put a wait(1) right after the click
And do
type("Calc")
type(Key.ENTER)
The issue you're having is your type statement: type("calc" + Key.ENTER)
This should be avoided.
You could try type("calc", Key.ENTER) but I'm unsure if this works. Hope this helps!
I think this is a bug in 1.1.3.
I am running 1.1.0 on a 64 bit Windows 10 PC and this code worked fine for me. I have never had issues concatenating a Key with a String because in Sikuli most of the key constants are actually String values including Key.ENTER documented here.
Maybe try:
wait(image)
type(image, "calc" + Key.ENTER)
Using type this way will click the image and then type whatever is in the second parameter.
Side note for #Michell Monarch:
type("calc", Key.ENTER) will search for the text "calc" on the screen, click it, and then press enter

How do I fix the route for acceptance tests?

I am trying to run acceptance tests on the yii2 advanced app. Out of the box the acceptance tests fail. I will just start with the first problem: I think the routes are wrong and I have no idea where to look to fix them. The error for the about page for example says:
Can't be on page "/frontend/web/index-test.php/site/about":
"/frontend/web/index-test.php/site/signup"
Where did it get this route from?? Of course there is no page there, that route is garbage. i tried putting it in a browser .. nothing .. of course. I would love to step through the testing classes to see what's going on but I can't figure that out either. Anyone have an idea on this? I think if I can get the routes right at least I can get somewhere.
Updated answer:
Make sure that you run php -S localhost:8080from the project root, and not from the test directory!
I just tried that, and got pretty much the same errors as you do.
Original answer:
Out of the box, you will need to do a couple of things before the tests can be run.
yii2-app-advanced tests readme
Install Codeception globally.
Create test db.
Go to tests/codeception/configand look at / edit config.php (see below)
Run migrations: codeception/bin/yii migrate
Fire up a webserver: php -S localhost:8080
Navigate to each of the directories in tests/codeceptionthat you want to test for - like frontend
Run codecept build
Run codecept run
It does run and it does succeed out of the box - provided that you haven't changed any code. :)
If you did change some code, then the tests breaks, and you will have to fix it.
tests/codeception/config/config.php:
'components' => [
'db' => [
'dsn' => 'mysql:host=localhost;dbname=name_of_test_db',
],
Edit:
That route looks fine to me, btw. I guess the issue is that you haven't fired up a webserver before engaging the tests.
You might need to fix your document roots, as described here: Installation Guide

PHPstorm console input not working during debug sessions

I'm using a PHP script which expects user input from a command like fgets(STDIN). The problem is it no longer works in the newest version of PHPStorm (10).
The same works when I run it directly (without debugger enabled) and anything I enter in the console is sent to the script (on direct run).
But during a debug session, when I try to input text at the script's prompt, it does not go to the script. My best guess is that the new REPL feature is overriding user input in console during debugging. I say this because pressing the UP/DOWN arrows opens up a popup with all PHP function names.
It used to work correctly with last version.
How can I send user input to my PHP script with this new version? Am I missing something here?
I'm not sure if this is the same thing, but I was running into this same problem, and I was able to get it working by deselecting the "Use Console Input" checkbox in the PHPStorm Console.
John's answer is perfect.
I want to mention that the Use Console Input is a tiny icon in sidebar of the debug console. I provide you by this image

MySQL Workbench: How can I see the detailed SQL query and errors when I use the "Apply" button? (confirmation popup)

I recently upgraded from MySQL Workbench 5.2.47 up to 6.1.
After making changes to a table via the Gui grid interface on the old version, I'd hit the 'Apply' button and have a popup confirming to make the change. This popup had the SQL code that would run in order to make the change that I made via the UI interface. I would then confirm the action and get a success or failure popup. If a an error occurred, I could see the detailed error in order to easily troubleshoot the problem.
With the new version, I make a change in the GUI interface and hit the 'Apply' button. No confirmation popup, it just executes. The result is a small snippet in output window. This is fine unless there's an error, in which case it has a very generic message. "1 error(s) saving changes to table XYZ". I have not found how to access the detailed error message, either by right clicking the row or looking in the preferences.
So, how do I get the popup confirmation with SQL query and error messaging to work in the new version or, at the very least, be able to see detailed SQL query error details?
Functionality restored in CE release: 6.1.7
http://dev.mysql.com/downloads/file.php?id=452662
It is indeed a bug :-(
In the MySQL bug database:
http://bugs.mysql.com/bug.php?id=72169
http://bugs.mysql.com/bug.php?id=72155
Until they don't fix the bug you can try to close the Query Tab. When it asks if you want Save the Changes or Not, you choose Save and then it shows the detailed errors :)