Summer Sale! All accounts are 50% off this week.

shan2590's avatar

How to use Tinker for testing purpose

Normally tinker use for populate data! Is there a way to using tinker to execute DB level unit testing? example ?

0 likes
4 replies
tisuchi's avatar

@shan2590

If you want to use tinker in general-purpose, doesn't factory help you to achieve that?

1 like
shan2590's avatar

@tisuchi both are doing same thing know?

I need to clarify using tinker test application. someone asked me to write test cases for test application using tinker.

I know PHP unit test. But don't know there is a way to test application using Tinker !

tisuchi's avatar

@shan2590

I see.

There might be a way to do that, but honestly, I never heard to write test in that way... !!!

2 likes
stanliwise's avatar

simple write all your logic in a regular php file with laravel syntax. The php file don't need to be inside your laravel folder. Next start Tinker And the type include('path_to_your_file');

hit enter and all your code with run as Tinker would include your script into the laravel tinker

Please or to participate in this conversation.