Skip to content

Commit

Permalink
feat: update to silverstripe version
Browse files Browse the repository at this point in the history
  • Loading branch information
wilr committed Jul 19, 2023
1 parent 2a58ad3 commit b33a038
Show file tree
Hide file tree
Showing 20 changed files with 114 additions and 520 deletions.
39 changes: 39 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# http://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,json,tf}]
# The indent size used in the `package.json` file cannot be changed
# https://github.com/npm/npm/pull/3180#issuecomment-16336516
indent_size = 2

[Makefile]
indent_style = tab

[*.go]
indent_style = tab

[*.sh]
indent_style = tab

[composer.json]
indent_size = 4

[*.{js,vue,scss}]
indent_size = 2

[*.js]
quote_type = single
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
ci:
name: CI
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1
with:
simple_matrix: true
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/.idea
/framework
/vendor
/vendor
.phpunit.result.cache
composer.lock
/public
12 changes: 0 additions & 12 deletions .php_cs

This file was deleted.

11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

66 changes: 33 additions & 33 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"name": "heyday/silverstripe-wkhtml",
"description": "Provides Wkhtml functionality in SilverStripe",
"type": "silverstripe-vendormodule",
"license": "MIT",
"autoload": {
"psr-4": {
"Heyday\\SilverStripe\\WkHtml\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Heyday\\SilverStripe\\WkHtml\\": "tests/"
}
},
"require": {
"php": ">=5.6",
"knplabs/knp-snappy": "^1",
"silverstripe/framework": "^4"
},
"require-dev": {
"phpunit/phpunit": "^5.7",
"mikey179/vfsstream": "^1"
},
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"config": {
"preferred-install": {
"silverstripe/framework": "source"
}
}
"name": "heyday/silverstripe-wkhtml",
"description": "Provides Wkhtml functionality in SilverStripe",
"type": "silverstripe-vendormodule",
"license": "MIT",
"autoload": {
"psr-4": {
"Heyday\\SilverStripe\\WkHtml\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Heyday\\SilverStripe\\WkHtml\\": "tests/"
}
},
"require": {
"knplabs/knp-snappy": "^1",
"silverstripe/framework": "^5"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"mikey179/vfsstream": "^1"
},
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
}
},
"config": {
"allow-plugins": {
"composer/installers": true,
"silverstripe/vendor-plugin": true
}
}
}
24 changes: 0 additions & 24 deletions phpunit.xml

This file was deleted.

9 changes: 9 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="vendor/silverstripe/framework/tests/bootstrap.php">
<testsuites>
<testsuite name="SilverStripe WkHtml">
<directory>./tests</directory>
</testsuite>
</testsuites>
</phpunit>
6 changes: 2 additions & 4 deletions src/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public function __construct(
InputInterface $input,
OutputInterface $output,
$cache = true
)
{
) {
$this->generator = $generator;
$this->input = $input;
$this->output = $output;
Expand All @@ -97,7 +96,7 @@ public function process()
{
if ($this->cacheOutput && $this->cache) {
$contents = $this->input->process();
$key = md5($contents);
$key = md5($contents ?? '');

if (!($output = $this->cache->get($key))) {
$output = $this->output->process($contents, $this->generator);
Expand Down Expand Up @@ -177,4 +176,3 @@ public function setCache(CacheInterface $cache)
$this->cache = $cache;
}
}

15 changes: 7 additions & 8 deletions tests/EchoValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@

namespace Heyday\SilverStripe\WkHtml;

use PHPUnit_Framework_MockObject_Stub;
use PHPUnit_Framework_MockObject_Invocation;
use PHPUnit_Util_Type;
use PHPUnit\Framework\MockObject\Stub\Stub;
use PHPUnit\Framework\MockObject\Invocation;

class EchoValue implements PHPUnit_Framework_MockObject_Stub
class EchoValue implements Stub
{
protected $value;

Expand All @@ -15,16 +14,16 @@ public function __construct($value)
$this->value = $value;
}

public function invoke(PHPUnit_Framework_MockObject_Invocation $invocation)
public function invoke(Invocation $invocation)
{
echo $this->value;
}

public function toString()
public function toString(): string
{
return sprintf(
'echo user-specified value %s',
PHPUnit_Util_Type::toString($this->value)
$this->value
);
}
}
}
2 changes: 1 addition & 1 deletion tests/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class GeneratorTest extends SapphireTest
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand Down
59 changes: 0 additions & 59 deletions tests/ImageHelperTest.php

This file was deleted.

4 changes: 1 addition & 3 deletions tests/Input/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public function testProcessBadReturn()
* Sets up the fixture, for example, opens a network connection.
* This method is called before a test is executed.
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand All @@ -126,5 +126,3 @@ protected function setUp()
$this->object = Request::create($this->request);
}
}


7 changes: 5 additions & 2 deletions tests/Input/StringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class StringTest extends SapphireTest
/**
*
*/
protected function setUp()
protected function setUp(): void
{
parent::setUp();

Expand All @@ -28,6 +28,9 @@ protected function setUp()
*/
public function testProcess()
{
$this->assertEquals('test', $this->object->process());
$this->assertStringContainsString(
'test',
$this->object->process()
);
}
}
Loading

0 comments on commit b33a038

Please sign in to comment.