This challenge consists of 3 parts:
- Writing PHP and SQL
- Refactoring code
- Writing unit tests
Having a PHP environment installed and configured is a prerequisite to this test.
# composer install --prefer-dist
Note: If you don't have composer
installed globally you can follow the instructions here: Composer download
# bin/phpunit
You may have to install the phpunit.phar
globally to run the tests. PHPUnit on Windows
If you see ASCII escape codes in cmd.exe
, copy phpunit.xml.dist
to phpunit.xml
and change colors="true"
to colors="false"
.
# php bin/console server:run
You should now be able to visit the web application at http://localhost:8000/ in your browser. Currently it is in a "broken" state as none of the required functionality has been implemented.
After making the failing tests pass you will have implemented all the required features on the site. You can verify the site is working correctly by browsing it and interacting with it after.
All the code you will need to write is contained to a single file: Avid\CandidateChallenge\Repository\DoctrineMemberRepository
.
No test code should be changed.
The database connection is available within the repository class from the parent class Repository::getConnection
.
There is a well tested class Avid\CandidateChallenge\Command\DumpTableStructure
that needs some clean-up.
Go through the code and make any changes you feel would simplify the code and make it more readable.
To run only the DumpTableStructure
tests use the following command:
bin/phpunit --filter DumpTableStructure
No test code should be changed.
Currently the Model\Member
class is un-tested. Add some unit tests for it.
bin/phpunit --filter Member
To check the coverage use the following command:
bin/phpunit --filter Member --coverage-text
# bin/console generate:members <number>
Doctrine DBAL - Wrapper for PHP PDO