This is a basic project for children aged 9 to 12 to learning programming through gamification (code blocks).
"XAMPP"
from the website https://www.apachefriends.org/index.html "Apache"
and "PHP"
Choose a folder to install XAMPP on and take note of the path
After installing go into "Environment Variables"
, you can do so by searching "Environmental Variable"
on the Windows search bar
PATH
section in "System Variables"
under "Environmental Variable"
"php" -> "php.ini"
, inside the "php.ini"
file uncomment "extension=sqlite3"
sudo apt install -y apache2 php libapache2-mod-php
sudo apt install -y php$(php -v | head -1 | cut -d ' ' -f2 | cut -d '.' -f1,2)-sqlite3
sudo service apache2 restart
cmd
in Windows or the terminal in Linuxphp -S localhost:8000
localhost:8000
in any desired web browsermain
branch will serve the final completed web service product.dev
will serve as a center point for all features, before merging into main
for the final product. dev
and be worked on individually before merging back to dev
upon completion.base
branch will contain all the universal files that is needed by all other feature and pages that contain no features.feature/<feature_name>
.templates
, styles
, images
and scripts
.
templates
are to contain only UI related files that contain no logic.styles
are to contain only CSS and beautify files.images
are to contain only images.scripts
are to contain only front-end logic of features such as Javascript files.backend_scripts
.<feature>page.php
Exception: index.php - This file will not reside in any folder to allow hosted server to automatically run it.
dev
have to be commited back to feature branch and merge again.dev
branch. git checkout -b <branchname>
- For a new branchgit add
- Adding file locallygit commit -m "<message>"
- Committing added files with messagegit push
- Pushing from local to remotemaster
Merging into master
will only be allowed when every feature branch have been completed and merged into dev
.
Uploaded diagrams can be found in the folder diagrams
.
The UAT video can be found in the folder tests
, or on YouTube at https://youtu.be/2ROyMSwDPJg.
The test suite and code coverage statistics were run and generated by a automated testing framework library for PHP called PHPunit
along with an additional php extension, XDebug
.
The test cases is located at test
directory under the name of challengemanagementTest.php
.
<?php
class challengemanagementTest extends \PHPUnit\Framework\TestCase{
public function test_symbolname(){
$challenge = new project\challengemanagement;
$result = $challenge->validatename("$@#@$$!");
$this->assertEquals("Invalid challenge name.", $result);
}
public function test_emptyname(){
$challenge = new project\challengemanagement;
$result = $challenge->validatename("");
$this->assertEquals("Invalid challenge name.", $result);
}
public function test_longname(){
$challenge = new project\challengemanagement;
$result = $challenge->validatename("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
$this->assertEquals("Invalid challenge name.", $result);
}
public function test_correctname(){
$challenge = new project\challengemanagement;
$result = $challenge->validatename("Challenge Maze!");
$this->assertEquals("", $result);
}
public function test_emptyendpoint(){
$challenge = new project\challengemanagement;
$result = $challenge->validatepoints("");
$this->assertEquals("Invalid endpoints input.", $result);
}
public function test_symbolinendpoint(){
$challenge = new project\challengemanagement;
$result = $challenge->validatepoints("4%");
$this->assertEquals("Invalid endpoints input.", $result);
}
public function test_longendpoint(){
$challenge = new project\challengemanagement;
$result = $challenge->validatepoints("444445");
$this->assertEquals("Invalid endpoints input.", $result);
}
public function test_nonnumeralendpoint(){
$challenge = new project\challengemanagement;
$result = $challenge->validatepoints("a");
$this->assertEquals("Invalid endpoints input.", $result);
}
public function test_correctendpoints(){
$challenge = new project\challengemanagement;
$result = $challenge->validatepoints("5");
$this->assertEquals("", $result);
}
}
?>
Results of test case execution:
The code coverage results can be found in the test
directory under html/challengemanagement.php.html
Hovering over the green-highlighted code lines will allow us to see which test case covered the code
Results of Code Coverage execution:
Composer:
Composer
can be downloaded from https://getcomposer.org/download/, click on Composer-Setup.exe
PHPUnit:
Once composer is installed open up the terminal or cmd and run the following code
composer require phpunit/phpunit
In the root directory of the project, create a phpunit.xml
file that includes the following content
<phpunit bootstrap="vendor/autoload.php"
colors="true"
stopOnFailure="false">
<testsuites>
<testsuite name="challengemanagement">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">challengemanagement.php</directory>
<file>/path/to/file</file>
</whitelist>
</filter>
</phpunit>
Run the command ./vendor/bin/phpunit --testdox
for the test suite results. PHPUnit will automatically detect the test suite with the name xxxTest
.
Successful:
Failure: Example when a test case did not pass the test
PHPUnit
and Composer
should have been installed earlier.
Xdebug:
composer require phpunit/php-code-coverage
https://xdebug.org/wizard
phpinfo()
. To generate type php -i
into terminal/cmd.php.ini
file and include the following lines
zend_extension = xdebug
xdebug.mode=coverage
./vendor/bin/phpunit --coverage-html html
html
file.