Skip to content

Commit

Permalink
PG-26
Browse files Browse the repository at this point in the history
  • Loading branch information
gammamatrix committed Nov 30, 2023
1 parent 98f04ee commit cc080fb
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 57 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Playground Matrix tests
name: 'Tests: Playground Matrix'

on:
push:
Expand Down Expand Up @@ -26,16 +26,17 @@ jobs:
with:
php_extensions: xdebug
coverage_clover: clover.xml
coverage_text: true
- name: Make code coverage badge
uses: timkrase/phpunit-coverage-badge@v1.2.1
with:
coverage_badge_path: output/coverage.svg
push_badge: false
- name: Git push to image-data branch
- name: Git push to testing/develop branch
uses: peaceiris/actions-gh-pages@v3
with:
publish_dir: ./output
publish_branch: image-data
publish_branch: testing/develop
github_token: ${{ secrets.GITHUB_TOKEN }}
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public/storage
# Test ignores
################################################################################

output

public/tests

phpunit.xml
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Playground Matrix

![Test Coverage](https://raw.githubusercontent.com/gammamatrix/playground-matrix/image-data/coverage.svg)
![Playground CI Workflow](https://github.com/gammamatrix/playground-matrix/actions/workflows/ci.yml/badge.svg?)
[![Playground CI Workflow](https://github.com/gammamatrix/playground-matrix/actions/workflows/ci.yml/badge.svg?branch=develop)](https://raw.githubusercontent.com/gammamatrix/playground-matrix/testing/develop/testdox.txt)
[![Test Coverage](https://raw.githubusercontent.com/gammamatrix/playground-matrix/testing/develop/coverage.svg)](tests)

The Playground Matrix is a package for [Laravel](https://laravel.com/docs/10.x) applications.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function up(): void
$table->uuid('owned_by_id')->nullable()->index();
$table->uuid('parent_id')->nullable()->index();
$table->string('board_type')->nullable()->index();
$table->uuid('backlog_id')->nullable()->index();
$table->uuid('epic_id')->nullable()->index();
$table->uuid('flow_id')->nullable()->index();
$table->uuid('milestone_id')->nullable()->index();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function up(): void
$table->uuid('owned_by_id')->nullable()->index();
$table->uuid('parent_id')->nullable()->index();
$table->string('epic_type')->nullable()->index();
$table->uuid('backlog_id')->nullable()->index();
$table->uuid('board_id')->nullable()->index();
$table->uuid('flow_id')->nullable()->index();
$table->uuid('milestone_id')->nullable()->index();
Expand Down
103 changes: 51 additions & 52 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,57 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
stopOnSkipped="false"
backupGlobals="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
cacheResult="false"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
testdox="true"
>
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<!-- <coverage
includeUncoveredFiles="true"
pathCoverage="false"
ignoreDeprecatedCodeUnits="true"
disableCodeCoverageIgnore="true">
<report>
<clover outputFile="tests/logs/clover.xml"/>
<cobertura outputFile="tests/logs/cobertura.xml"/>
<crap4j outputFile="tests/logs/crap4j.xml" threshold="50"/>
<html outputDirectory="tests/logs/html" lowUpperBound="50" highLowerBound="90"/>
<php outputFile="tests/logs/coverage.php"/>
<text outputFile="tests/logs/coverage.txt" showUncoveredFiles="false" showOnlySummary="true"/>
<xml outputDirectory="tests/logs/xml"/>
</report>
</coverage> -->
<logging>
<junit outputFile="tests/logs/junit.xml"/>
<teamcity outputFile="tests/logs/teamcity.txt"/>
<testdoxHtml outputFile="tests/logs/testdox.html"/>
<testdoxText outputFile="tests/logs/testdox.txt"/>
</logging>
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.1/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
stopOnSkipped="false"
backupGlobals="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
cacheResult="false"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false"
displayDetailsOnIncompleteTests="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
testdox="true">
<testsuites>
<testsuite name="Unit">
<directory>tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory>tests/Feature</directory>
</testsuite>
</testsuites>
<coverage
includeUncoveredFiles="true"
pathCoverage="false"
ignoreDeprecatedCodeUnits="true"
disableCodeCoverageIgnore="true">
<report>
<clover outputFile="output/clover.xml"/>
<cobertura outputFile="output/cobertura.xml"/>
<crap4j outputFile="output/crap4j.xml" threshold="50"/>
<!-- <html outputDirectory="output/html" lowUpperBound="50" highLowerBound="90"/> -->
<php outputFile="output/coverage.php"/>
<text outputFile="output/coverage.txt" showUncoveredFiles="false" showOnlySummary="true"/>
<!-- <xml outputDirectory="output/xml"/> -->
</report>
</coverage>
<logging>
<junit outputFile="output/junit.xml"/>
<teamcity outputFile="output/teamcity.txt"/>
<testdoxHtml outputFile="output/testdox.html"/>
<testdoxText outputFile="output/testdox.txt"/>
</logging>
<source>
<include>
<directory suffix=".php">src</directory>
Expand Down
14 changes: 14 additions & 0 deletions src/Models/Board.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Board extends Model
'owned_by_id' => null,
'parent_id' => null,
'board_type' => null,
'backlog_id' => null,
'epic_id' => null,
'flow_id' => null,
'milestone_id' => null,
Expand Down Expand Up @@ -121,6 +122,7 @@ class Board extends Model
'owned_by_id',
'parent_id',
'board_type',
'backlog_id',
'epic_id',
'flow_id',
'milestone_id',
Expand Down Expand Up @@ -193,6 +195,18 @@ class Board extends Model
'sources',
];

/**
* The backlog of the board.
*/
public function backlog(): HasOne
{
return $this->hasOne(
Backlog::class,
'id',
'backlog_id'
);
}

/**
* The epic of the board.
*/
Expand Down
14 changes: 14 additions & 0 deletions src/Models/Epic.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Epic extends Model
'owned_by_id' => null,
'parent_id' => null,
'epic_type' => null,
'backlog_id' => null,
'board_id' => null,
'flow_id' => null,
'milestone_id' => null,
Expand Down Expand Up @@ -121,6 +122,7 @@ class Epic extends Model
'owned_by_id',
'parent_id',
'epic_type',
'backlog_id',
'board_id',
'flow_id',
'milestone_id',
Expand Down Expand Up @@ -193,6 +195,18 @@ class Epic extends Model
'sources',
];

/**
* The backlog of the epic.
*/
public function backlog(): HasOne
{
return $this->hasOne(
Backlog::class,
'id',
'backlog_id'
);
}

/**
* The board of the epic.
*/
Expand Down
5 changes: 5 additions & 0 deletions tests/Feature/Board/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class ModelTest extends ModelCase
'rule' => 'create',
'modelClass' => \GammaMatrix\Playground\Matrix\Models\Board::class,
],
'backlog' => [
'key' => 'backlog_id',
'rule' => 'create',
'modelClass' => \GammaMatrix\Playground\Matrix\Models\Backlog::class,
],
'epic' => [
'key' => 'epic_id',
'rule' => 'create',
Expand Down
5 changes: 5 additions & 0 deletions tests/Feature/Epic/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ class ModelTest extends ModelCase
'rule' => 'create',
'modelClass' => \GammaMatrix\Playground\Matrix\Models\Epic::class,
],
'backlog' => [
'key' => 'backlog_id',
'rule' => 'create',
'modelClass' => \GammaMatrix\Playground\Matrix\Models\Backlog::class,
],
'board' => [
'key' => 'board_id',
'rule' => 'create',
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Board/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ModelTest extends ModelCase
'modifier',
'owner',
'parent',
'backlog',
'epic',
'flow',
'milestone',
Expand Down
1 change: 1 addition & 0 deletions tests/Unit/Epic/ModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ModelTest extends ModelCase
'modifier',
'owner',
'parent',
'backlog',
'board',
'flow',
'milestone',
Expand Down

0 comments on commit cc080fb

Please sign in to comment.