commit
08f56f08d2
@ -0,0 +1,24 @@
|
|||||||
|
*~
|
||||||
|
.\#*
|
||||||
|
\#*\#
|
||||||
|
.*.~undo-tree~
|
||||||
|
|
||||||
|
# Created by https://www.toptal.com/developers/gitignore/api/phpunit
|
||||||
|
# Edit at https://www.toptal.com/developers/gitignore?templates=phpunit
|
||||||
|
|
||||||
|
### PHPUnit ###
|
||||||
|
# Covers PHPUnit
|
||||||
|
# Reference: https://phpunit.de/
|
||||||
|
|
||||||
|
# Generated files
|
||||||
|
.phpunit.result.cache
|
||||||
|
.phpunit.cache
|
||||||
|
|
||||||
|
# PHPUnit
|
||||||
|
/app/phpunit.xml
|
||||||
|
/phpunit.xml
|
||||||
|
|
||||||
|
# Build data
|
||||||
|
/build/
|
||||||
|
|
||||||
|
# End of https://www.toptal.com/developers/gitignore/api/phpunit
|
@ -0,0 +1,2 @@
|
|||||||
|
* php-template
|
||||||
|
It is a simple project that uses php, unit test and CI/CD.
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"require-dev": {
|
||||||
|
"phpunit/phpunit": "^9.5"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,12 @@
|
|||||||
|
{ pkgs ? import <nixpkgs> { } }:
|
||||||
|
pkgs.mkShell {
|
||||||
|
name = "MyPHPShell";
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
php80
|
||||||
|
php80Packages.composer
|
||||||
|
];
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
echo "Welcome to my php8 shell";
|
||||||
|
'';
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class Simple
|
||||||
|
{
|
||||||
|
public function add($a, $b)
|
||||||
|
{
|
||||||
|
return $a + $b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function subtract($a, $b)
|
||||||
|
{
|
||||||
|
return $a - $b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once 'src/Simple.php';
|
||||||
|
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class SimpleTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testAdd()
|
||||||
|
{
|
||||||
|
$simple = new Simple();
|
||||||
|
$result = $simple->add(2, 3);
|
||||||
|
$this->assertEquals(5, $result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSubtract()
|
||||||
|
{
|
||||||
|
$simple = new Simple();
|
||||||
|
$result = $simple->subtract(3, 2);
|
||||||
|
$this->assertEquals(1, $result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
Loading…
Reference in new issue