- FEATURES
- Autoload
- Class Reflection
- Magic Methods
- Exceptions
- Late Static Binding
- Type Hinting
- SPL
-
PHPUNIT
- PHAR
- COMPOSER
- Carbon
- Guzzle
- Faker
- Math
- Requests
- DESIGN PATTERNS
- Singleton Pattern
- Observer Pattern
- Strategy Pattern
- Dependency Injection
- Middleware
- Registry
- SYMFONY
- Routes
- Annotations
- Flex
- Controllers
- Doctrine
- Templating
- VERSIONS
- Php7.4
- Php8.0
- SECURITY
- Filter Input
- Remote Code Injection
- Sql Injection
- Session Fixation
- File Uploads
- Cross Site Scripting
- Spoofed Forms
- CSRF
- Session Hijacking
- MODERN PHP
- Composer
- Autoloader
- Package
- Releases
- Generators
- Dependency Injection
- Middleware
- CUSTOM FRAMEWORK
- App
- Http Foundation
- Front Controller
- Routing
- Render Controller
- Resolver
- SoC
- FRAMEWORKS
- Slim
- Symfony V5
- Laravel V8
- Laminas V3
- Codeigniter V4
Install PhpUnit
Install PhpUnit with Composer.
cd /var/www/tests.local/php/
composer require --dev phpunit/phpunit ^8
./vendor/bin/phpunit --version
Update version
composer require --dev phpunit/phpunit ^9
Test file (testNumber.php)
require __DIR__ . '/../vendor/autoload.php';
use PHPUnit\Framework\TestCase;
function isEven($n) { return $n%2 == 0; }
function isOdd($n) { return $n%2 != 0; }
final class TestNumber extends TestCase
{
public function testEven()
{
$this->assertEquals(isEven(2), true);
$this->assertEquals(isEven(3), false);
}
public function testOdd()
{
$this->assertEquals(isOdd(2), false);
$this->assertEquals(isOdd(3), true);
}
}
Run test
./vendor/bin/phpunit tests/testNumber.php
# 2 / 2 (100%)
Last update: 531 days ago