Log message #4125329

# At Username Text
# Mar 15th 2018, 13:02 generitter Read the PHPUnit documentation. CakePHP enhances the unit testing with fixtures and what not, but most of the how to is in PHPUnit. I would also write my business logic code in service objects so that database layer calls could be mocked easily.
# Mar 15th 2018, 12:58 roel Hello everyone, I want to learn how to test my code with php unittest. Does anyone have any pointers/best practices or tutorials I can read other than the CakePHP test documentation? It would be great if there is a tutorial available that focuses on the creating of unit tests of the "Tutorials and Examples" within the CakePHP documentation. Thanks in advance :slightly_smiling_face:
# Mar 15th 2018, 12:51 jason001 hey guys, does anyone have any experience using wkhtmltopdf with cakephp3? i'm running into some problems setting the cookie
# Mar 15th 2018, 12:48 alysson-azevedo yes
# Mar 15th 2018, 12:48 alysson-azevedo yrd
# Mar 15th 2018, 12:47 graziel maybe you have some iframe hiding css in theme
# Mar 15th 2018, 12:44 bnb_dev can some one let me know the problem is where?
# Mar 15th 2018, 12:32 bnb_dev How I fix it?
# Mar 15th 2018, 12:31 bnb_dev when I use $this->viewBuilder()->theme('MyTheme'); $this->viewBuilder()->layout('MyTheme.default'); in beforeRender() then DebugKit does not show.
# Mar 15th 2018, 12:26 saeideng >can we built tree list for multi list, yes
# Mar 15th 2018, 12:23 saeideng @
# Mar 15th 2018, 12:18 yadav.manu36 in the appController right?
# Mar 15th 2018, 12:17 alysson-azevedo you might want use something like ``` if (!array_key_exists('_serialize', $this->viewVars) andand in_array($this->response->getType(), ['application/json', 'application/xml']) ) { $this->set('_serialize', true); } ```
# Mar 15th 2018, 12:16 yadav.manu36 @alysson-azevedo Thanks, now it is working fine.
# Mar 15th 2018, 12:15 loginews I am reading https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html. Grateful if someone could confirm this: I can only use a finder in a controller or table. Fair enough. If I write -- $data=$mytable->find('all'); -- in a controller, will $mytable correspond automatically to a table called "mytable" in my database? And will $data automatically be visible in my edit.ctp ?
# Mar 15th 2018, 12:14 yadav.manu36 File uploaded https://cakesf.slack.com/files/U83JZGBTR/F9PNM8N1E/image.png / https://slack-files.com/T053DPNCM-F9PNM8N1E-d5ee51d156
# Mar 15th 2018, 12:14 alysson-azevedo try add `$this->set('_serialize', true);` into your index action
# Mar 15th 2018, 12:12 yadav.manu36 $this->loadComponent('RequestHandler');
# Mar 15th 2018, 12:12 yadav.manu36 ye i have loaded
# Mar 15th 2018, 12:11 alysson-azevedo @yadav.manu36 did you loaded the component RequestHandler on your controller?
# Mar 15th 2018, 12:01 yadav.manu36 File uploaded https://cakesf.slack.com/files/U83JZGBTR/F9QCB5WKC/-.txt / https://slack-files.com/T053DPNCM-F9QCB5WKC-7616a31410
# Mar 15th 2018, 12:00 yadav.manu36 I am using RESTful Routes in plugin and i am getting "Template file \"Api\\Users\\json\\index.ctp\" is missing." error please check below Router::prefix('api', function ($routes) { $routes->plugin( 'UserManager', ['path' => '/user-manager'], function (RouteBuilder $routes) { $routes->setExtensions(['json']); $routes->resources('Users'); $routes->fallbacks(DashedRoute::class); } ); });
# Mar 15th 2018, 11:58 yadav.manu36 Hi all
# Mar 15th 2018, 11:52 johnwayne @edgaras.jan thank you for helping, but if I count the response time second it is mostly the same, main problem is ->query()->update() for each price
# Mar 15th 2018, 11:19 alysson-azevedo nevermind, i need to use `Cake\Http\Client\Response` instead `Cake\Http\Response`
# Mar 15th 2018, 11:17 alysson-azevedo i mean, i cant even find the "isRedirected()" method in the `Cake\Http\Response` class
# Mar 15th 2018, 11:16 slackebot /home/alysson/ws/rx/apirx/vendor/cakephp/cakephp/src/Http/Client.php:366
# Mar 15th 2018, 11:16 alysson-azevedo Hi, i'm trying write some tests to my code, but i getting some strange error. ``` $response = new Response(); $mock->expects($this->once()) ->method('send') ->will($this->returnValue([$response])); ... ``` But when i run the code, php throws the error: Error : Call to undefined method Cake\Http\Response::isRedirect() /home/alysson/ws/rx/apirx/vendor/cakephp/cakephp/src/Http/Client.php:401
# Mar 15th 2018, 10:40 sandeep556 How to built tree list for multi-tree where data are organize according to scope first.
# Mar 15th 2018, 10:32 bnb_dev php -m is showing the PDO, pdo_mysql and pdo_sqlite
# Mar 15th 2018, 10:31 edgaras.jan @johnwayne you can use `$matchedData = Hash::combine($matchedData, '{n}.place_id', '{n}');` before outer loop
# Mar 15th 2018, 10:27 bnb_dev ok
# Mar 15th 2018, 10:26 sandeep556 @saeideng can we built tree list for multi list, where one list come after other list. currently it maxed-up with each other
# Mar 15th 2018, 10:26 edgaras.jan @johnwayne rebuild array, so $key is place_id, so you skip inner loop by using `$csvPrice = $matchedData[$dbPrice['place_id']];`
# Mar 15th 2018, 10:25 edgaras.jan if you can't enable pdo_sqlite, define debug_kit connection using mysql or other engine
# Mar 15th 2018, 10:24 bnb_dev ok
# Mar 15th 2018, 10:24 edgaras.jan check your app logs/error.log
# Mar 15th 2018, 10:24 bnb_dev ok
# Mar 15th 2018, 10:24 edgaras.jan sqlite3 and pdo_sqlite are different extensions
# Mar 15th 2018, 10:23 bnb_dev I used this one php5.6-sqlite3
# Mar 15th 2018, 10:22 johnwayne @garas how do you mean?