We use cookies on this site to enhance your user experience. By clicking "OK, I Agree" or using our site, you consent to the use of cookies unless you have disabled them.
View our cookie policy to learn more.

Create a Tests directory inside AppBundle. Now mimic your directory structure.
So, add a Controller directory, then an API directory, and finish it with
a new PHPUnit test class for ProgrammerController. Be a good programmer
and fill in the right namespace. All these directories: technically unnecessary.
But now we've got a sane setup.

Leave a comment!

Thank you for this tip! Yeah, in a newer version of Guzzle (newer than we use in this course) they renamed "base_url" -> "base_uri".

Cheers!

2019-04-12Александр

base_uri, not base_url

2018-06-04Victor Bocharsky

Hey Shaun,

You probably need an integration test, but it depends on tools you use. I suppose you use PHPUnit, so take a look at functional tests: http://symfony.com/doc/curr... . You need to authenticate user, create a new post and then check that the post has the current user in createdBy field.

Cheers!

2018-06-03Shaun

In my app I am using Doctrine Blameable Extension, so it sets the current user when creating a post on the createdBy field.