Skip to content

Commit

Permalink
feat: migrate to gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Jul 26, 2023
1 parent f2ba65a commit 2f517bf
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ jobs:
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
with:
simple_matrix: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/vendor/
composer.lock
/resources/
.phpunit.result.cache
/assets
/public
.phpunit.result.cache
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"extra": {
"branch-alias": {
"dev-main": "1.x-dev"
"dev-main": "2.x-dev"
},
"expose": [
"css"
Expand Down
22 changes: 11 additions & 11 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/silverstripe/framework/tests/bootstrap.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<directory suffix=".php">tests/php</directory>
</exclude>
</coverage>
<testsuite name="Default">
<directory>tests/php</directory>
</testsuite>
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">src/</directory>
</include>
<exclude>
<directory suffix=".php">tests/php</directory>
</exclude>
</coverage>
<testsuite name="Default">
<directory>tests/php</directory>
</testsuite>
</phpunit>
7 changes: 2 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# SilverStripe Elemental Virtual

[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dnadesign/silverstripe-elemental-virtual/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dnadesign/silverstripe-elemental-virtual/?branch=master)
[![codecov](https://codecov.io/gh/dnadesign/silverstripe-elemental-virtual/branch/master/graph/badge.svg)](https://codecov.io/gh/dnadesign/silverstripe-elemental-virtual)
[![Version](http://img.shields.io/packagist/v/dnadesign/silverstripe-elemental-virtual.svg?style=flat)](https://packagist.org/packages/dnadesign/silverstripe-elemental-virtual)
[![License](http://img.shields.io/packagist/l/dnadesign/silverstripe-elemental-virtual.svg?style=flat)](licence)
[![CI](https://github.com/dnadesign/silverstripe-elemental-virtual/actions/workflows/ci.yml/badge.svg)](https://github.com/dnadesign/silverstripe-elemental-virtual/actions/workflows/ci.yml)

## Introduction

Expand All @@ -13,5 +10,5 @@ linked to multiple pages.
## Installation

```
composer require dnadesign/silverstripe-elemental-virtual ^1
composer require dnadesign/silverstripe-elemental-virtual
```
32 changes: 32 additions & 0 deletions tests/Src/TestElement.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace DNADesign\ElementalVirtual\Tests\Src;

use DNADesign\Elemental\Models\BaseElement;
use SilverStripe\Dev\TestOnly;
use SilverStripe\Security\Permission;

class TestElement extends BaseElement implements TestOnly
{
private static $table_name = 'TestElement';

private static $db = [
'TestValue' => 'Text',
];

private static $controller_class = TestElementController::class;

public function getType()
{
return 'A test element';
}

public function canView($member = null)
{
$check = Permission::checkMember($member, 'ADMIN');
if ($check !== null) {
return $check;
}
return parent::canView($member);
}
}
10 changes: 10 additions & 0 deletions tests/Src/TestElementController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace DNADesign\ElementalVirtual\Tests\Src;

use SilverStripe\CMS\Controllers\ContentController;
use SilverStripe\Dev\TestOnly;

class TestPageController extends ContentController implements TestOnly
{
}
11 changes: 11 additions & 0 deletions tests/Src/TestPage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace DNADesign\ElementalVirtual\Tests\Src;

use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Dev\TestOnly;

class TestPage extends SiteTree implements TestOnly
{
private static $table_name = 'TestElementalPage';
}
12 changes: 5 additions & 7 deletions tests/php/BaseElementExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
namespace DNADesign\ElementalVirtual\Tests;

use DNADesign\Elemental\Models\BaseElement;
use DNADesign\Elemental\Models\ElementalArea;
use DNADesign\Elemental\Tests\Src\TestElement;
use DNADesign\Elemental\Tests\Src\TestPage;
use DNADesign\ElementalVirtual\Control\ElementVirtualLinkedController;
use DNADesign\ElementalVirtual\Tests\Src\TestElement;
use DNADesign\ElementalVirtual\Tests\Src\TestPage;
use DNADesign\ElementalVirtual\Model\ElementVirtual;
use SilverStripe\Core\Config\Config;
use SilverStripe\Dev\SapphireTest;
Expand All @@ -15,14 +14,14 @@ class BaseElementExtensionTest extends SapphireTest
{
protected static $fixture_file = 'BaseElementExtensionTest.yml';

/** @var TestPage */
protected $page;

protected static $extra_dataobjects = [
TestElement::class,
TestPage::class
];

/** @var TestPage */
protected $page;

public function setUp(): void
{
parent::setUp();
Expand All @@ -47,7 +46,6 @@ public function testVirtualElementAnchor(): void
public function testRendersIntoHolder(): void
{
$element = $this->objFromFixture(ElementVirtual::class, 'virtual1');
$linked = $this->objFromFixture(TestElement::class, 'element1');

$controller = ElementVirtualLinkedController::create($element);

Expand Down

0 comments on commit 2f517bf

Please sign in to comment.