Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
maheel-desilva committed Jun 9, 2020
0 parents commit 55398d2
Show file tree
Hide file tree
Showing 29 changed files with 2,823 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.idea
/vendor
.DS_Store
Thumbs.db
53 changes: 53 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Toy Robot - PHP

## Install Dependencies

Install dependencies prior to running th application as below.

composer install

Or navigate to the root directory of the project and run

php composer.phar install

### Run Program

This code has been written in PHP 7, hence this must be run on PHP 7 environment

Navigate to the root directory and run,

php index.php file_name

Example:
php index.php robot_commands

##### NOTE: I have included one CVS file in upload directory, if you need to add more files please add them in the same directory run the command with the file name as in abvoe example without the file extension.

### Run Unit Tests

PHPUnit has been used for unit tests and Mockery library has been used to mock dependencies

Navigate to the root directory and run,

vendor/bin/phpunit test


### Improvements to be done

- Use a dependency injection container to manage class dependencies
- Use a logger library like Monolog to log exceptions
- Use Docker to run the application
- Write unit test for rest of the classes and add more test cases for already written test classes


### Directory structure

- src - All the program related original code
- test - Unit tests for original code
- upload - CSV file which should be processed are stored here


### Assumptions

- Commands are running from a CSV file (please add in the upload directory)
- REPORT command will be the last command in the sequence
12 changes: 12 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"require-dev": {
"phpunit/phpunit": "^6.5",
"mockery/mockery": "^1.0"
},
"autoload": {
"psr-4": {
"ToyRobot\\": "src/",
"ToyRobotUnitTest\\": "test/"
}
}
}
Loading

0 comments on commit 55398d2

Please sign in to comment.