Pictureworks Laravel Coding Test: Migration of non-oo legacy application into the Laravel/Eloquent framework.
Make sure your server meets the following requirements.
- PostgreSQL server
- Composer installed 1.9+
- PHP Version 7.4.x+
- Show user detail
- Update existing comments field of user with identifier
id
provided - A command line executions to update comments of specific user such as
php controller.php ID COMMENTS
whereID
is user identifier andCOMMENTS
is some amount of comments, potentially with spaces.
Install composer with the help of the instructions given here
$ wget https://getcomposer.org/composer.phar
$ chmod +x composer.phar
$ mv composer.phar /usr/local/bin/composer
Fork and/or clone this project by running the following command
git clone https://github.com/umagloire99/pgphptest.git
Navigate into the project's directory
cd pgphptest
Copy .env.example for .env and modify according to your credentials
cp .env.example .env
Run this command to install dependencies
composer insatall --prefer-dist
This command will install all dependencies needed by the Pictureworks Laravel Coding Test to run successfully!
Generate application key
php artisan key:generate
This command will help migrate the database and populate the database!
php artisan migrate --seed
Specify your static user password in your .env that would be used to identify you
STATIC_USER_PASSWORD=''
Run the default laravel server
php artisan serve
- Request:
GET
- Url
http://localhost:8000/user/{id}
where id is the unique user identifier
- Request
POST
- Url
http://localhost:8000/user/update-comments
- Parameters:
id
(unique user identifier type integer),comments
(type string) andpassword
(type string)
By default, we have created 10 fake user data.
Run this command to test the different endpoints
vendor/bin/phpunit tests/UserControllerTests.php