Skip to content

Commit 429f126

Browse files
authored
Merge pull request #19 from bumpcore/14-tests
14 tests
2 parents 782e5d9 + edee335 commit 429f126

29 files changed

Lines changed: 779 additions & 58 deletions

.github/workflows/tests.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- "*.x"
8+
pull_request:
9+
branches:
10+
- master
11+
- "*.x"
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
23+
- name: Validate composer.json and composer.lock
24+
run: composer validate --strict
25+
26+
- name: Cache Composer packages
27+
id: composer-cache
28+
uses: actions/cache@v3
29+
with:
30+
path: vendor
31+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
32+
restore-keys: |
33+
${{ runner.os }}-php-
34+
35+
- name: Install dependencies
36+
run: composer install --prefer-dist --no-progress
37+
38+
- name: Execute Tests
39+
run: vendor/bin/pest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/vendor/
2+
/build/
23
composer.lock
34
.php-cs-fixer.cache
45
.php-cs-fixer.php

composer.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@
3232
]
3333
}
3434
},
35-
"scripts": {
36-
"test": "vendor/bin/phpunit"
37-
},
3835
"require-dev": {
39-
"orchestra/testbench": "^7.15",
40-
"phpunit/phpunit": "^9.5"
36+
"pestphp/pest": "^1.22",
37+
"orchestra/testbench": "^7.19"
38+
},
39+
"config": {
40+
"allow-plugins": {
41+
"pestphp/pest-plugin": true
42+
}
4143
}
4244
}

phpunit.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
4+
bootstrap="vendor/autoload.php"
5+
colors="true"
6+
>
7+
<testsuites>
8+
<testsuite name="Test Suite">
9+
<directory suffix="Test.php">./tests</directory>
10+
</testsuite>
11+
</testsuites>
12+
<coverage processUncoveredFiles="true">
13+
<include>
14+
<directory suffix=".php">./app</directory>
15+
<directory suffix=".php">./src</directory>
16+
</include>
17+
</coverage>
18+
</phpunit>

phpunit.xml.dist

Lines changed: 0 additions & 32 deletions
This file was deleted.

resources/php/table.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<table>
2-
<?php if ($data('withHeadings') && ($headings = array_shift($data('content')))): ?>
2+
<?php if ($data('withHeadings') && ($headings = $data('content')[array_key_first($data('content'))])): ?>
33
<thead>
44
<tr>
5-
@foreach ($headings as $heading)
5+
<?php foreach ($headings as $heading): ?>
66
<th><?= $heading; ?></th>
7-
@endforeach
7+
<?php endforeach; ?>
88
</tr>
99
</thead>
1010
<?php endif; ?>

resources/views/table.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<table>
2-
@if ($data('withHeadings') && ($headings = array_shift($data('content'))))
2+
@if ($data('withHeadings') && ($headings = $data('content')[array_key_first($data('content'))]))
33
<thead>
44
<tr>
55
@foreach ($headings as $heading)

src/Block/Data.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,6 @@ public function set(string $key, mixed $value): void
8585
Arr::set($this->validatedData, $key, $value);
8686
}
8787

88-
/**
89-
* Checks whether data passes the rules or not.
90-
*
91-
* @return bool
92-
*/
93-
public function isValid(): bool
94-
{
95-
return !Helpers::makeValidator($this->data, $this->rules)->fails();
96-
}
97-
9888
/**
9989
* Validates raw data.
10090
*
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
66
use Illuminate\Database\Eloquent\Model;
77

8-
class EditorPhp implements CastsAttributes
8+
class EditorPhpCast implements CastsAttributes
99
{
1010
/**
1111
* @param Model $model
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace BumpCore\EditorPhp\Exceptions;
4+
5+
use Exception;
6+
7+
class EditorPhpException extends Exception
8+
{
9+
// ...
10+
}

0 commit comments

Comments
 (0)