add PHP boilerplate

This commit is contained in:
Lexi / Zoe 2020-06-28 17:19:42 +02:00
parent 7007922739
commit 5512a19e1f
Signed by: binaryDiv
GPG Key ID: F8D4956E224DA232
8 changed files with 1913 additions and 3 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
/tmp/
# Editors
.vscode
.idea
# PHP
/vendor/
/coverage/

View File

@ -1,5 +1,5 @@
# NoteCat
Note taking app, similar to Evernote.
"Like Notepad, but meow!"
Note taking app, similar to Evernote.
"Like Notepad, but meow!"

27
composer.json Normal file
View File

@ -0,0 +1,27 @@
{
"name": "binarydiv/notecat",
"description": "Note taking app. Like Notepad, but meow!",
"type": "project",
"authors": [
{
"name": "binaryDiv",
"email": "binarydiv@gmail.com"
}
],
"require": {
"php": "^7.4"
},
"require-dev": {
"phpunit/phpunit": "^9"
},
"autoload": {
"psr-4": {
"NoteCat\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\Unit\\": "tests/unit/"
}
}
}

1806
composer.lock generated Normal file

File diff suppressed because it is too large Load Diff

28
phpunit.xml Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.2/phpunit.xsd"
bootstrap="vendor/autoload.php"
executionOrder="depends,defects"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<testsuites>
<testsuite name="unit-tests">
<directory suffix="Test.php">tests/unit</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="coverage/" lowUpperBound="60" highLowerBound="100"/>
<log type="coverage-text" target="php://stdout" showUncoveredFiles="false"/>
</logging>
</phpunit>

9
public/index.php Normal file
View File

@ -0,0 +1,9 @@
<?php
declare(strict_types=1);
require_once __DIR__ . '/../vendor/autoload.php';
use NoteCat\HelloWorld;
$hello = new HelloWorld();
echo '<b>' . $hello->getHello() . "</b>\n";

12
src/HelloWorld.php Normal file
View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace NoteCat;
class HelloWorld
{
public function getHello(): string
{
return 'Hello world! :3';
}
}

View File

@ -0,0 +1,19 @@
<?php
declare(strict_types=1);
namespace Tests\Unit;
use NoteCat\HelloWorld;
use PHPUnit\Framework\TestCase;
/**
* @covers NoteCat\HelloWorld
*/
final class HelloWorldTest extends TestCase
{
public function testGetHello(): void
{
$hello = new HelloWorld();
$this->assertSame('Hello Drone! :3', $hello->getHello());
}
}