Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
Merge pull request #32 from AlxisHenry/develop
Browse files Browse the repository at this point in the history
Merge unit tests
  • Loading branch information
AlxisHenry committed Jan 9, 2023
2 parents a417288 + 3eb2d2b commit b94a69f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "cdn",
"version": "1.0.0",
"version": "1.0.1",
"description": "https://github.com/AlxisHenry/cdn.alexishenry.eu",
"directories": {
"test": "tests"
},
"scripts": {
"phpstan": "vendor/bin/phpstan analyse --level=9 -c phpstan.neon --xdebug",
"tests": "./vendor/bin/phpunit --testdox tests/"
"tests": "./vendor/bin/phpunit --colors --testdox tests/"
},
"repository": {
"type": "git",
Expand Down
42 changes: 42 additions & 0 deletions tests/DashboardTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?php

use PHPUnit\Framework\TestCase;
use Symfony\Component\Yaml\Yaml;

require_once __DIR__ . '/../app/Classes/Dashboard.php';

class DashboardTest extends TestCase
{
public function testDashboardSettingsStaticFunctionReturnsObject()
{
$this->assertIsObject(Dashboard::settings());
}

public function testDashboardSettingsStaticFunctionReturnsDashboardObject()
{
$this->assertInstanceOf(Dashboard::class, Dashboard::settings());
}

public function testDashboardSettingsStaticFunctionReturnsDashboardObjectWithNeededProperties()
{
$dashboard = Dashboard::settings();
$this->assertObjectHasAttribute('title', $dashboard);
$this->assertObjectHasAttribute('description', $dashboard);
}

public function testEnsureDashboardConfigurationFileExists()
{
$this->assertFileExists(__DIR__ . '/../settings.yml');
}

public function testDashboardSettingsStaticFunctionReturnsDashboardObjectWithNeededPropertiesAndValues()
{
$dashboard = Dashboard::settings();
$this->assertObjectHasAttribute('title', $dashboard);
$this->assertObjectHasAttribute('description', $dashboard);
$settings = Yaml::parseFile(__DIR__ . '/../settings.yml');
$this->assertEquals($settings['dashboard']['title'], $dashboard->getTitle());
$this->assertEquals($settings['dashboard']['description'], $dashboard->getDescription());
}

}

0 comments on commit b94a69f

Please sign in to comment.