Extract a phpactor mixin
This commit is contained in:
parent
44d2685854
commit
6443b72707
11 changed files with 13 additions and 7 deletions
6
modules/mixins/phpactor/config/phpactor.yml
Normal file
6
modules/mixins/phpactor/config/phpactor.yml
Normal file
|
@ -0,0 +1,6 @@
|
|||
code_transform.class_new.variants:
|
||||
collection: collection
|
||||
default: default
|
||||
drupal-functional-test: drupal-functional-test
|
||||
drupal-kernel-test: drupal-kernel-test
|
||||
drupal-unit-test: drupal-unit-test
|
|
@ -0,0 +1,22 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} implements \IteratorAggregate {
|
||||
|
||||
public function __construct(private array $items = []) {
|
||||
}
|
||||
|
||||
public function getIterator(): \Iterator {
|
||||
return new \ArrayIterator($this->items);
|
||||
}
|
||||
|
||||
public function toArray(): array {
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
}
|
||||
{% endfor %}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} {
|
||||
}
|
||||
{% endfor %}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} extends BrowserTestBase {
|
||||
|
||||
public $defaultTheme = 'stark';
|
||||
|
||||
public static $modules = [];
|
||||
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
||||
{% endfor %}
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
use Drupal\KernelTests\KernelTestBase;
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} extends KernelTestBase {
|
||||
|
||||
public static $modules = [];
|
||||
|
||||
protected $strictConfigSchema = FALSE;
|
||||
|
||||
public function setUp(): void {
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
}
|
||||
{% endfor %}
|
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace {{ prototype.namespace }};
|
||||
|
||||
use Drupal\Tests\UnitTestCase;
|
||||
|
||||
{% for class in prototype.classes %}
|
||||
final class {{ class.name }} extends UnitTestCase {
|
||||
|
||||
}
|
||||
{% endfor %}
|
11
modules/mixins/phpactor/default.nix
Normal file
11
modules/mixins/phpactor/default.nix
Normal file
|
@ -0,0 +1,11 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
environment.systemPackages = with pkgs; [
|
||||
phpactor
|
||||
];
|
||||
|
||||
home-manager.users.opdavies.xdg.configFile.phpactor = {
|
||||
source = ./config;
|
||||
recursive = true;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue