Set Up PHPUnit

Closes chandler-1.
This commit is contained in:
Ilya Bakhlin 2021-12-25 22:24:27 +01:00
parent 791a25812c
commit 11e11add72
5 changed files with 2091 additions and 3 deletions

3
.gitignore vendored
View file

@ -5,6 +5,9 @@
# PhpStorm
/.idea/
# PHPUnit
/tests/cache/
/chandler.yml
/extensions/available/*

View file

@ -1,4 +1,14 @@
{
"autoload": {
"classmap": [
"chandler/Eventing/Events/Event.php"
]
},
"autoload-dev": {
"psr-4": {
"Chandler\\Tests\\": "tests"
}
},
"description": "TODO: Add a description.",
"license": "GPL-3.0-or-later",
"minimum-stability": "stable",
@ -16,5 +26,9 @@
"tracy/tracy": "^2.7",
"symfony/translation": "^5.0",
"symfony/yaml": "^5.3"
}
},
"require-dev": {
"phpunit/phpunit": "^9.5"
},
"type": "project"
}

2016
composer.lock generated

File diff suppressed because it is too large Load diff

13
phpunit.xml Normal file
View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<phpunit bootstrap="vendor/autoload.php" cacheResultFile="tests/cache/result.txt" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd">
<coverage cacheDirectory="tests/cache" processUncoveredFiles="true">
<include>
<file>chandler/Eventing/Events/Event.php</file>
</include>
</coverage>
<testsuites>
<testsuite name="All Test">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>

View file

@ -0,0 +1,46 @@
<?php
declare(strict_types = 1);
namespace Chandler\Tests\Chandler\Eventing\Events;
use Chandler\Eventing\Events\Event;
use PHPUnit\Framework\TestCase;
/**
* @package Chandler\Tests\Chandler\Eventing\Events
*/
class EventTest extends TestCase
{
/**
* @return void
*/
public function testPropertyCode(): void
{
$this->assertClassHasAttribute("code", Event::class);
}
/**
* @return void
*/
public function testPropertyData(): void
{
$this->assertClassHasAttribute("data", Event::class);
}
/**
* @return void
*/
public function testPropertyPristine(): void
{
$this->assertClassHasAttribute("pristine", Event::class);
}
/**
* @return void
*/
public function testPropertyTime(): void
{
$this->assertClassHasAttribute("time", Event::class);
}
}