-
Notifications
You must be signed in to change notification settings - Fork 8
Next coding dojo solution #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
MarcinGladkowski
wants to merge
87
commits into
CodingDojoSilesia:master
Choose a base branch
from
MarcinGladkowski:marcin-solution
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
87 commits
Select commit
Hold shift + click to select a range
5519ddc
config: first basic setup
MarcinGladkowski 44f3c37
config: setup coding standards
MarcinGladkowski 5af90f1
config: add setup to php-cs-fixer
MarcinGladkowski 27995ef
config: fix php-cs-fixer
MarcinGladkowski 5117fa1
test: fix basic test
MarcinGladkowski 47bbc1d
feat: add simple classes for commands, coins, change namespaces,
MarcinGladkowski d6da82e
feat: create item classes
MarcinGladkowski bfa0262
feat: create ConsoleRequest
MarcinGladkowski 9d75d5f
feat: add InputParser interface, add ConsoleInputParser
MarcinGladkowski b6e708f
feat: create object to contain parsed request
MarcinGladkowski e0abfed
feat: add Item interface
MarcinGladkowski b5c1587
feat: return Money from Request
MarcinGladkowski a3ffa29
feat: ItemRepository interface
MarcinGladkowski aa83fde
feat: move methods to abstract class for Item
MarcinGladkowski d5b181c
test: add simple Item unit tests
MarcinGladkowski 8748d8d
feat: implementation of in memory repository
MarcinGladkowski edb9006
feat: Dime extends Money
MarcinGladkowski d8c1ec2
test: in memory repository
MarcinGladkowski ecc3a05
feat: add values to Money classes
MarcinGladkowski c36e710
feat: add enum with available money
MarcinGladkowski 0fcf7a0
feat: add ShortCode to money
MarcinGladkowski 9088be3
feat: console parser with tests
MarcinGladkowski e11f34a
feat: BuyItemCommand implementation on interfaces, simple test
MarcinGladkowski 2ac0b06
feat: method for simple model creation
MarcinGladkowski 18ab086
fix: short code for Nickel
MarcinGladkowski 45d7d4e
feat: Collection to managing money
MarcinGladkowski 334dce1
test: MoneyCollectionTest
MarcinGladkowski 3c05828
feat: implement Interface for Request
MarcinGladkowski da033e2
test: test for calculating rest with exact and not
MarcinGladkowski 28f4818
test: BuyItemCommand valid return type
MarcinGladkowski ac6f452
ref: remove unused use statements
MarcinGladkowski 300bb04
feat: PaymentCoordinator - calculate rest of payment
MarcinGladkowski 51a1b84
feat: VendingMachine - execute BuyItemCommand service
MarcinGladkowski 279b7f1
feat: InputParser add MoneyCollection typing
MarcinGladkowski a412351
feat: simple class for Response
MarcinGladkowski 2b348d3
feat: Request for buy services
MarcinGladkowski 5ee6cb6
feat: implementation for simple Request interface
MarcinGladkowski ee56193
feat: ConsoleRequest - use MoneyCollection
MarcinGladkowski fe3c53c
feat: Item list, method to valid money to buy item
MarcinGladkowski 0b8fcd5
fix: first commit from 13/04/2020 with tests fixes
46b2fa6
test: working with parsing tests, extends for more examples
MarcinGladkowski ef0840e
tests: add two test cases to parser test
MarcinGladkowski 4272151
ref: remove type annotation
MarcinGladkowski 95581fe
ref: add comments about new class instances
MarcinGladkowski 6de56ad
tests: use data provider
MarcinGladkowski 0933322
tests: add payment coordinator property
MarcinGladkowski 3d5d34c
tests: pay for product without any money
MarcinGladkowski e6b148a
tests: next test to try for paying for product
MarcinGladkowski e797f33
tests: test with minus value of money
MarcinGladkowski d7d11e6
ref: format
MarcinGladkowski 4f86bd1
ref: load autoload based on lang const
MarcinGladkowski bcb99f2
ref: return console object, remove annotations
MarcinGladkowski 7840e5f
ref: set product classes as final, add strict types
MarcinGladkowski d0ff43e
config: update php image to php:8.1, update dependencies
MarcinGladkowski c1b8952
config: commit lock file
MarcinGladkowski 41a50cd
ref: formatting of code, add test to test buy command
MarcinGladkowski 7f5ae9d
config: update image to 8.1
MarcinGladkowski 779c637
build: update on building environment using docker
MarcinGladkowski d346480
build: possibility to install dependencies on host
MarcinGladkowski e45a1d9
ref: fix phpunit errors
MarcinGladkowski 1c28aae
ref: passing tests, two assertions commented, to fix
MarcinGladkowski 78881f3
ref: fix sorting after 8.1 changes, all tests passed
MarcinGladkowski 0f7b9ac
tests: add assertion to MoneyCollection
MarcinGladkowski 36bbb38
tests: invalid case with parsing get input
MarcinGladkowski 4a7b9f1
feat: recognize product code from input, change values in items to co…
MarcinGladkowski 8627062
ref: remove command factory
MarcinGladkowski a599630
test: formatting of exception, add test to expecting exception
MarcinGladkowski 63ef9f1
test: check returning output
MarcinGladkowski d9347a1
test: order with dollar without exact change, and get rest
MarcinGladkowski 181dd66
ref: extract buy command
MarcinGladkowski 03a68b9
feat: implement interfaces and CoinReturnCommand tests
MarcinGladkowski 13f824c
feat: first implementation of return coins command
MarcinGladkowski 246b949
feat: coin return response
MarcinGladkowski 93cc8e2
feat: return rest with ordered product
MarcinGladkowski b3ac1f1
ref: change name to result
MarcinGladkowski cba537d
ref: implement Stringable interface
MarcinGladkowski 19e7e64
ref: set items shortcodes to regex
MarcinGladkowski 8760377
ref: move method with available coins to specialized class
MarcinGladkowski 10c5484
ref: php 8 arguments
MarcinGladkowski 3a7e692
tests: add A item
MarcinGladkowski fdfc0a3
ref: PSR-12 changes
MarcinGladkowski 170c255
ref: replace to invokable, contravariance complicated class inheritance
MarcinGladkowski 60a2cb3
ref: run code sniffer quality PSR rules
MarcinGladkowski 7d288cd
ref: phpstan, undefined abstract class properties
MarcinGladkowski 0bbbc1e
ref: replace creating money by constructor to static method
MarcinGladkowski 6647d44
ref: money creation interface
MarcinGladkowski ce91b68
ref: formatting code
MarcinGladkowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| FROM php:8.1 | ||
|
|
||
| RUN apt-get update && apt-get install --no-install-recommends -y \ | ||
| wget \ | ||
| vim \ | ||
| git \ | ||
| unzip | ||
|
|
||
| RUN pecl install xdebug && docker-php-ext-enable xdebug | ||
|
|
||
| COPY --from=composer /usr/bin/composer /usr/bin/composer | ||
|
|
||
| RUN mkdir -p /app | ||
|
|
||
| COPY composer.* /app/ | ||
|
|
||
| WORKDIR /app | ||
|
|
||
| RUN composer install --no-interaction | ||
|
|
||
| COPY . . | ||
|
|
||
| CMD ["/bin/bash"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| check: phpunit phpcs phpstan fix | ||
|
|
||
| run: | ||
| docker-compose run --rm vending_machine bash | ||
|
|
||
| copy_vendor: | ||
| sudo docker cp vending_machine:/usr/src/app/vendor ./ | ||
|
|
||
| phpunit: | ||
| ./vendor/bin/phpunit | ||
|
|
||
| phpcs: | ||
| ./vendor/bin/phpcs --standard=PSR1 ./src | ||
| ./vendor/bin/phpcs --standard=PSR2 ./src | ||
|
|
||
| phpstan: | ||
| ./vendor/bin/phpstan analyse src --level max | ||
|
|
||
| fix: | ||
| ./vendor/bin/php-cs-fixer fix ./src --dry-run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,21 @@ | ||
| #Coding Dojo Silesia #3 | ||
|
|
||
| ## Vending machine kata - PHP | ||
|
|
||
| Instructions: https://code.joejag.com/coding-dojo/vending-machine/ | ||
| Tests: `./bin/vendor/phpunit` | ||
| Tests: `./vendor/bin/phpunit` | ||
|
|
||
| ### Setup | ||
| Run commands: | ||
| * `docker-compose up` | ||
|
|
||
| ### Run | ||
| Open interactive bash `docker-compose run --rm vending_machine bash` | ||
|
|
||
| ### Development | ||
| Copy dependencies form volume: `sudo docker cp vending_machine:/usr/src/app/vendor ./` | ||
|
|
||
| ### Install dependencies (to local developing) | ||
| `docker-compose run --rm vending_machine composer install` | ||
|
|
||
| ### Run tests | ||
| `docker-compose run --rm vending_machine ./vendor/bin/phpunit` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't a good idea:
.envor temporary builded files.COPY . .triggers on each changing in context directory - It could be problem with cacheing layer.