Skip to content

Commit

Permalink
Added new test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
vinkla committed Oct 21, 2023
1 parent 5a691a6 commit 73d967f
Show file tree
Hide file tree
Showing 40 changed files with 420 additions and 204 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ jobs:
with:
php-version: 8.2
coverage: xdebug
tools: php-cs-fixer, cs2pr
- run: php-cs-fixer fix . --dry-run --rules=@PER --format=checkstyle | cs2pr
tools: cs2pr
- run: composer install --prefer-dist --no-interaction
- run: vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
44 changes: 44 additions & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

/**
* Copyright (c) Vincent Klaiber.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @see https://github.com/vinkla/extended-acf
*/

declare(strict_types=1);

$header = <<<EOF
Copyright (c) Vincent Klaiber.
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
@see https://github.com/vinkla/extended-acf
EOF;

$config = new PhpCsFixer\Config();

$finder = PhpCsFixer\Finder::create()
->exclude('examples')
->in(__DIR__);

return $config
->setRules([
'@PER' => true,
'declare_strict_types' => true,
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => $header,
'location' => 'after_open',
],
'no_unused_imports' => true,
'ordered_imports' => true,
'ordered_traits' => true,
])
->setFinder($finder)
->setRiskyAllowed(true)
->setUsingCache(false);
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
"autoload-dev": {
"psr-4": {
"Extended\\Tests\\ACF\\": "tests/"
"Extended\\ACF\\Tests\\": "tests/"
},
"files": [
"tests/helpers.php"
Expand Down
2 changes: 1 addition & 1 deletion examples/options-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'fields' => [
WysiwygEditor::make('Text', 'cookie_text')
->instructions('Add the cookie disclaimer text.')
->mediaUpload(false)
->disableMediaUpload(false)
->tabs('visual')
->required(),
Text::make('Label', 'cookie_label')
Expand Down
2 changes: 1 addition & 1 deletion examples/with-extended-cpts.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
'fields' => [
WysiwygEditor::make('Answer')
->instructions('Add the question answer.')
->mediaUpload(false)
->disableMediaUpload()
->tabs('visual')
->required(),
],
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/ButtonGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
class ButtonGroup extends Field
{
use Choices;
use ConditionalLogic;
use DefaultValue;
use DirectionLayout;
use ConditionalLogic;
use Instructions;
use Required;
use ReturnFormat;
Expand Down
4 changes: 2 additions & 2 deletions src/Fields/Checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
class Checkbox extends Field
{
use Choices;
use ConditionalLogic;
use DefaultValue;
use Disabled;
use DirectionLayout;
use ConditionalLogic;
use Disabled;
use Instructions;
use Required;
use ReturnFormat;
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/DatePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class DatePicker extends Field
use ConditionalLogic;
use DateTimeFormat;
use Disabled;
use Immutable;
use Instructions;
use Required;
use WeekDay;
use Wrapper;
use Immutable;

protected string|null $type = 'date_picker';
}
2 changes: 1 addition & 1 deletion src/Fields/DateTimePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class DateTimePicker extends Field
use ConditionalLogic;
use DateTimeFormat;
use Disabled;
use Immutable;
use Instructions;
use Required;
use WeekDay;
use Wrapper;
use Immutable;

protected string|null $type = 'date_time_picker';
}
6 changes: 3 additions & 3 deletions src/Fields/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@

class Email extends Field
{
use Affixable;
use ConditionalLogic;
use DefaultValue;
use Disabled;
use Immutable;
use Instructions;
use Affixable;
use Placeholder;
use Required;
use Wrapper;
use Immutable;
use DefaultValue;

protected string|null $type = 'email';
}
2 changes: 1 addition & 1 deletion src/Fields/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class File extends Field
{
use ConditionalLogic;
use FileSize;
use FileTypes;
use Instructions;
use Library;
use FileTypes;
use Required;
use ReturnFormat;
use Wrapper;
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class Gallery extends Field
use ConditionalLogic;
use Dimensions;
use FileSize;
use FileTypes;
use Instructions;
use Library;
use FileTypes;
use MinMax;
use PreviewSize;
use Required;
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
class Group extends Field
{
use ConditionalLogic;
use Fields;
use Instructions;
use Layout;
use Fields;
use Required;
use Wrapper;

Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ class Image extends Field
use ConditionalLogic;
use Dimensions;
use FileSize;
use FileTypes;
use Instructions;
use Library;
use FileTypes;
use PreviewSize;
use Required;
use ReturnFormat;
Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

class Layout extends Field
{
use MinMax;
use Fields;
use MinMax;

protected string $keyPrefix = 'layout';

Expand Down
2 changes: 1 addition & 1 deletion src/Fields/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

class Message extends Field
{
use MessageAttribute;
use ConditionalLogic;
use MessageAttribute;
use NewLines;

protected string|null $type = 'message';
Expand Down
6 changes: 3 additions & 3 deletions src/Fields/Number.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,17 @@

class Number extends Field
{
use Affixable;
use ConditionalLogic;
use DefaultValue;
use Disabled;
use Immutable;
use Instructions;
use MinMax;
use Affixable;
use Placeholder;
use Step;
use Required;
use Step;
use Wrapper;
use Immutable;

protected string|null $type = 'number';
}
4 changes: 2 additions & 2 deletions src/Fields/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@

class Password extends Field
{
use Affixable;
use ConditionalLogic;
use Immutable;
use Instructions;
use Affixable;
use Placeholder;
use Required;
use Wrapper;
use Immutable;

protected string|null $type = 'password';
}
4 changes: 2 additions & 2 deletions src/Fields/RadioButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
class RadioButton extends Field
{
use Choices;
use ConditionalLogic;
use DefaultValue;
use Disabled;
use DirectionLayout;
use ConditionalLogic;
use Disabled;
use Instructions;
use Nullable;
use Required;
Expand Down
6 changes: 3 additions & 3 deletions src/Fields/Range.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@

class Range extends Field
{
use Affixable;
use ConditionalLogic;
use DefaultValue;
use Disabled;
use Immutable;
use Instructions;
use MinMax;
use Step;
use Affixable;
use Required;
use Step;
use Wrapper;
use Immutable;

protected string|null $type = 'range';
}
2 changes: 1 addition & 1 deletion src/Fields/Repeater.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ class Repeater extends Field
{
use ButtonLabel;
use ConditionalLogic;
use Fields;
use Instructions;
use Layout;
use MinMax;
use Fields;
use Required;
use Wrapper;

Expand Down
4 changes: 2 additions & 2 deletions src/Fields/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@
class Select extends Field
{
use Choices;
use ConditionalLogic;
use DefaultValue;
use Disabled;
use ConditionalLogic;
use Immutable;
use Instructions;
use Multiple;
use Nullable;
use Required;
use ReturnFormat;
use Wrapper;
use Immutable;

protected string|null $type = 'select';

Expand Down
6 changes: 3 additions & 3 deletions src/Fields/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@

class Text extends Field
{
use MaxLength;
use Affixable;
use ConditionalLogic;
use DefaultValue;
use Disabled;
use Immutable;
use Instructions;
use Affixable;
use MaxLength;
use Placeholder;
use Required;
use Wrapper;
use Immutable;

protected string|null $type = 'text';
}
4 changes: 2 additions & 2 deletions src/Fields/Textarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@

class Textarea extends Field
{
use MaxLength;
use ConditionalLogic;
use DefaultValue;
use Disabled;
use Immutable;
use Instructions;
use MaxLength;
use NewLines;
use Placeholder;
use Required;
use Wrapper;
use Immutable;

protected string|null $type = 'textarea';

Expand Down
4 changes: 2 additions & 2 deletions src/Fields/TimePicker.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
class TimePicker extends Field
{
use ConditionalLogic;
use Disabled;
use DateTimeFormat;
use Disabled;
use Immutable;
use Instructions;
use Required;
use Wrapper;
use Immutable;

protected string|null $type = 'time_picker';
}
2 changes: 1 addition & 1 deletion src/Fields/URL.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ class URL extends Field
use ConditionalLogic;
use DefaultValue;
use Disabled;
use Immutable;
use Instructions;
use Placeholder;
use Required;
use Wrapper;
use Immutable;

protected string|null $type = 'url';
}
2 changes: 1 addition & 1 deletion tests/ConditionalLogicTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

declare(strict_types=1);

namespace Extended\ACF\Tests;
namespace Extended\Tests\ACF;

use Extended\ACF\ConditionalLogic;
use Extended\ACF\Fields\Repeater;
Expand Down
Loading

0 comments on commit 73d967f

Please sign in to comment.