Update Composer, update everything

This commit is contained in:
Oliver Davies 2018-11-23 12:29:20 +00:00
parent ea3e94409f
commit dda5c284b6
19527 changed files with 1135420 additions and 351004 deletions

View file

@ -0,0 +1,41 @@
### Issue title
The issue title should comply with the following structure:
[ *ISSUE-GROUP* ] Short description
The *ISSUE-GROUP* should be one of:
* `command:name`
* `console`
* `helper`
* `standard`
* `template`
* `translation`
* `test`
* `docs`
### Problem/Motivation
A brief statement describing why the issue was filed.
**Details to include:**
- Why are we doing this? Above all, a summary should explain why a change is needed, in a few short sentences.
### How to reproduce
Include steps related how to reproduce.
**Details to include:**
- Drupal version (you can obtain this by running `drupal site:status`).
- Console version (you can obtain this by running `composer show | grep drupal/console`).
- Console Launcher version (you can obtain this by running outside of a drupal site `drupal --version`).
- Steps to reproduce
- Include screen-shot or video whenever necessary.
### Solution
A brief description of the proposed fix.
**Details to include:**
- A short summary of the approach proposed or used in the PR.
- Approaches that have been tried and ruled out.
- Links to relevant API documentation or other resources.
- Known workarounds.

40
vendor/drupal/console/.gitignore vendored Normal file
View file

@ -0,0 +1,40 @@
# deprecation-detector
/.rules
# Composer
composer.lock
/vendor
/bin/phpunit
/bin/jsonlint
/bin/phpcbf
/bin/phpcs
/bin/validate-json
/bin/pdepend
/bin/php-cs-fixer
/bin/phpmd
/bin/php-parse
/bin/psysh
PATCHES.txt
# Develop
autoload.local.php
# Binaries
/box.phar
/console.phar
/drupal.phar
/drupal.phar.version
# Test
/phpunit.xml
# Drupal
/core
/nbproject/
# drupal/console-extend-plugin generated files
extend.console.*.yml
*-console.services.yml
#PhpStorm
.idea/*

10
vendor/drupal/console/.php_cs vendored Normal file
View file

@ -0,0 +1,10 @@
<?php
return PhpCsFixer\Config::create()
->setRules(
[
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
]
)
->setUsingCache(false);

49
vendor/drupal/console/.travis.yml vendored Normal file
View file

@ -0,0 +1,49 @@
sudo: false
language: php
php:
- 5.5.9
- 5.6
- 7.0
- 7.1
- hhvm
matrix:
fast_finish: true
allow_failures:
- php: hhvm
- php: 7.0
- php: 7.1
env:
global:
- PROJECT_DIR=/home/project
before_script:
- phpenv config-rm xdebug.ini
# This fixes a fail when install Drupal.
- echo 'sendmail_path = /bin/true' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini
- composer self-update
- composer install --no-dev
# - curl -LSs https://box-project.github.io/box2/installer.php | php
# - composer global require drupal/coder:~8.1
script:
- if [ -n "${TRAVIS_BUILD_DIR+1}" ]; then PROJECT_DIR=$TRAVIS_BUILD_DIR; fi
# - phpunit
# - php box.phar build
# - php drupal.phar init
# - php drupal.phar check
# - php drupal.phar site:new drupal8.dev --latest --no-interaction
# - cd drupal8.dev
# - php ../drupal.phar site:install standard --langcode=en --db-type=sqlite --db-file=sites/default/files/.ht.sqlite --site-name="Drupal 8 Site Install" --site-mail=admin@example.com --account-name=admin --account-mail=admin@example.com --account-pass=admin --no-interaction
# - php ../drupal.phar chain --file=$PROJECT_DIR/config/dist/chain/sample.yml
# - ~/.composer/vendor/bin/phpcs --warning-severity=0 --standard=~/.composer/vendor/drupal/coder/coder_sniffer/Drupal/ruleset.xml $PROJECT_DIR/drupal8.dev/modules/custom/example
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/637685414a0d0ef9d4c6
on_success: change
on_failure: always

65
vendor/drupal/console/CONTRIBUTING.md vendored Normal file
View file

@ -0,0 +1,65 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
- [Issue title](#issue-title)
- [Problem/Motivation](#problemmotivation)
- [How to reproduce](#how-to-reproduce)
- [Solution](#solution)
- [Minimum Requirements](#minimum-requirements)
- [Support](#support)
- [Documentation](#documentation)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
### Issue title
The issue title should comply with the following structure:
[ *ISSUE-GROUP* ] Short description
The *ISSUE-GROUP* should be one of:
* `command:name`
* `console`
* `helper`
* `standard`
* `template`
* `translation`
* `test`
* `docs`
### Problem/Motivation
A brief statement describing why the issue was filed.
**Details to include:**
- Why are we doing this? Above all, a summary should explain why a change is needed, in a few short sentences.
### How to reproduce
Include steps related how to reproduce.
**Details to include:**
- Drupal version (you can obtain this by running `drupal site:status`).
- Console version (you can obtain this by running `composer show | grep drupal/console`).
- Console Launcher version (you can obtain this by running outside of a drupal site `drupal --version`).
- Steps to reproduce
- Include screen-shot or video whenever necessary.
### Solution
A brief description of the proposed fix.
**Details to include:**
- A short summary of the approach proposed or used in the PR.
- Approaches that have been tried and ruled out.
- Links to relevant API documentation or other resources.
- Known workarounds.
### Minimum Requirements
This project requires Drupal 8.
### Support
**Do not open issue for support question, only features and bugs.** For question please visit our [DrupalConsole Gitter room](https://gitter.im/hechoendrupal/DrupalConsole).
### Documentation
There's been some amazing Drupal Community work done around DrupalConsole. Many of your questions can be answered in our [DrupalConsole Book](https://www.gitbook.com/book/hechoendrupal/drupal-console/details).
If you find documentation in this DrupalConsole Book inaccurate or missing, you can created a new issue at [DrupalConsole Book](https://github.com/hechoendrupal/drupal-console-book) repository.

339
vendor/drupal/console/LICENSE.txt vendored Normal file
View file

@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

101
vendor/drupal/console/README.md vendored Normal file
View file

@ -0,0 +1,101 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*
- [Drupal Console](#drupal-console)
- [Required PHP version](#required-php-version)
- [Drupal Console documentation](#documentation)
- [Download Drupal Console](#download)
- [Run Drupal Console](#run)
- [Contributors](#contributors)
- [Supporting organizations](#supporting-organizations)
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
Drupal Console
=============================================
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hechoendrupal/DrupalConsole)
[![Build Status](https://travis-ci.org/hechoendrupal/drupal-console.svg?branch=master)](https://travis-ci.org/hechoendrupal/drupal-console)
[![Latest Stable Version](https://poser.pugx.org/drupal/console/v/stable.svg)](https://packagist.org/packages/drupal/console)
[![Latest Unstable Version](https://poser.pugx.org/drupal/console/v/unstable.svg)](https://packagist.org/packages/drupal/console)
[![Software License](https://img.shields.io/badge/license-GPL%202.0+-blue.svg)](https://packagist.org/packages/drupal/console)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d0f089ff-a6e9-4ba4-b353-cb68173c7d90/mini.png)](https://insight.sensiolabs.com/projects/d0f089ff-a6e9-4ba4-b353-cb68173c7d90)
The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
## Latest Version
Details of the latest version can be found on the Drupal Console project page under https://drupalconsole.com/.
## Releases Page
All notable changes to this project will be documented in the [releases page](https://github.com/hechoendrupal/DrupalConsole/releases)
## Documentation
The most up-to-date documentation can be found at [http://docs.drupalconsole.com/](http://docs.drupalconsole.com/).
More information about using this project at the [official documentation](http://docs.drupalconsole.com/en/using/project.html).
## Required PHP Version
PHP 5.5.9 or higher is required to use the Drupal Console application.
## Download
[Install Drupal Console Using Composer](https://docs.drupalconsole.com/en/getting/composer.html)
[Install Drupal Console Launcher](https://docs.drupalconsole.com/en/getting/launcher.html)
[Installing Drupal Console on Windows](https://docs.drupalconsole.com/en/getting/windows.html)
## Run
Using the DrupalConsole Launcher
```
drupal
```
We highly recommend you to install the global executable, but if is not installed, you can run Drupal Console depending on your installation by executing:
```
vendor/bin/drupal
# or
vendor/drupal/console/bin/drupal
# or
bin/drupal
```
## Drupal Console Support
You can ask for support at Drupal Console gitter chat room [http://bit.ly/console-support](http://bit.ly/console-support).
## Contribute to Drupal Console
* [Getting the project](https://docs.drupalconsole.com/en/contributing/getting-the-project.html)
* [Running the project](https://docs.drupalconsole.com/en/contributing/running-the-project.html)
## Enabling Autocomplete
```
# You can enable autocomplete by executing
drupal init
# Bash: Bash support depends on the http://bash-completion.alioth.debian.org/
# project which can be installed with your package manager of choice. Then add
# this line to your shell configuration file.
source "$HOME/.console/console.rc" 2>/dev/null
# Zsh: Add this line to your shell configuration file.
source "$HOME/.console/console.rc" 2>/dev/null
# Fish: Create a symbolic link
ln -s ~/.console/drupal.fish ~/.config/fish/completions/drupal.fish
```
## Contributors
[Full list of contributors](https://drupalconsole.com/contributors)
## Supporting Organizations
[![weKnow](https://www.drupal.org/files/weKnow-logo_5.png)](http://weknowinc.com)
[![Anexus](https://www.drupal.org/files/anexus-logo.png)](http://www.anexusit.com/)
[All supporting organizations](https://drupalconsole.com/supporting-organizations)
> Drupal is a registered trademark of Dries Buytaert.

View file

@ -0,0 +1,123 @@
<?php
namespace Drupal\Console\Test;
use Symfony\Component\Console\Helper\HelperSet;
use Drupal\Console\Helper\TwigRendererHelper;
use Drupal\Console\Helper\HelperTrait;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Drupal\Console\Helper\ContainerHelper;
abstract class BaseTestCase extends \PHPUnit_Framework_TestCase
{
use HelperTrait;
public $dir;
/**
* @var \Symfony\Component\Console\Helper\HelperSet
*/
protected $helperSet;
protected function setup()
{
$this->setUpTemporaryDirectory();
}
public function setUpTemporaryDirectory()
{
$this->dir = sys_get_temp_dir() . "/modules";
}
public function getHelperSet($input = null)
{
if (!$this->helperSet) {
$stringHelper = $this->getMockBuilder('Drupal\Console\Helper\StringHelper')
->disableOriginalConstructor()
->setMethods(['createMachineName'])
->getMock();
$stringHelper->expects($this->any())
->method('createMachineName')
->will($this->returnArgument(0));
$validator = $this->getMockBuilder('Drupal\Console\Helper\ValidatorHelper')
->disableOriginalConstructor()
->setMethods(['validateModuleName'])
->getMock();
$validator->expects($this->any())
->method('validateModuleName')
->will($this->returnArgument(0));
$translator = $this->getTranslatorHelper();
$chain = $this
->getMockBuilder('Drupal\Console\Helper\ChainCommandHelper')
->disableOriginalConstructor()
->setMethods(['addCommand', 'getCommands'])
->getMock();
$drupal = $this
->getMockBuilder('Drupal\Console\Helper\DrupalHelper')
->setMethods(['isBootable', 'getDrupalRoot'])
->getMock();
$siteHelper = $this
->getMockBuilder('Drupal\Console\Helper\SiteHelper')
->disableOriginalConstructor()
->setMethods(['setModulePath', 'getModulePath'])
->getMock();
$siteHelper->expects($this->any())
->method('getModulePath')
->will($this->returnValue($this->dir));
$consoleRoot = __DIR__.'/../';
$container = new ContainerBuilder();
$loader = new YamlFileLoader($container, new FileLocator($consoleRoot));
$loader->load('services.yml');
$this->helperSet = new HelperSet(
[
'renderer' => new TwigRendererHelper(),
'string' => $stringHelper,
'validator' => $validator,
'translator' => $translator,
'site' => $siteHelper,
'chain' => $chain,
'drupal' => $drupal,
'container' => new ContainerHelper($container),
]
);
}
return $this->helperSet;
}
protected function getInputStream($input)
{
$stream = fopen('php://memory', 'r+', false);
fputs($stream, $input . str_repeat("\n", 10));
rewind($stream);
return $stream;
}
public function getTranslatorHelper()
{
$translatorHelper = $this
->getMockBuilder('Drupal\Console\Helper\TranslatorHelper')
->disableOriginalConstructor()
->setMethods(['loadResource', 'trans', 'getMessagesByModule', 'writeTranslationsByModule'])
->getMock();
$translatorHelper->expects($this->any())
->method('getMessagesByModule')
->will($this->returnValue([]));
return $translatorHelper;
}
}

View file

@ -0,0 +1,71 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorServiceCommandTest.
*/
namespace Drupal\Console\Test\Command\Generate;
use Drupal\Console\Command\Generate\ServiceCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ServiceDataProviderTrait;
use Drupal\Console\Test\Command\GenerateCommandTest;
class ServiceCommandTest extends GenerateCommandTest
{
use ServiceDataProviderTrait;
/**
* Service generator test
*
* @param $module
* @param $name
* @param $class
* @param $interface
* @param $services
* @param $path_service
*
* @dataProvider commandData
*/
public function testGenerateService(
$module,
$name,
$class,
$interface,
$services,
$path_service
) {
$command = new ServiceCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$code = $commandTester->execute(
[
'--module' => $module,
'--name' => $name,
'--class' => $class,
'--interface' => $interface,
'--services' => $services,
'--path_service' => $path_service,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\ServiceGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,19 @@
<?php
namespace Drupal\Console\Test\Command;
use Symfony\Component\DependencyInjection\Container;
use Drupal\Console\Test\BaseTestCase;
abstract class GenerateCommandTest extends BaseTestCase
{
/**
* @return \Symfony\Component\DependencyInjection\ContainerInterface Drupal container
*/
protected function getContainer()
{
$container = new Container();
$container->set('twig', new \Twig_Environment());
return $container;
}
}

View file

@ -0,0 +1,57 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GenerateEntityBundleCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\EntityBundleCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\EntityBundleDataProviderTrait;
class GenerateEntityBundleCommandTest extends GenerateCommandTest
{
use EntityBundleDataProviderTrait;
/**
* ContentType generator test
*
* @param $module
* @param $bundle_name
* @param $bundle_title
*
* @dataProvider commandData
*/
public function testGenerateContentType(
$module,
$bundle_name,
$bundle_title
) {
$command = new EntityBundleCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--bundle-name' => $bundle_name,
'--bundle-title' => $bundle_title
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\EntityBundleGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorAuthenticationProviderCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\AuthenticationProviderCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\AuthenticationProviderDataProviderTrait;
class GeneratorAuthenticationProviderCommandTest extends GenerateCommandTest
{
use AuthenticationProviderDataProviderTrait;
/**
* AuthenticationProvider generator test
*
* @param $module
* @param $class
*
* @dataProvider commandData
*/
public function testGenerateAuthenticationProvider(
$module,
$class
) {
$command = new AuthenticationProviderCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\AuthenticationProviderGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,60 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorCommandCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\CommandCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\CommandDataProviderTrait;
class GeneratorCommandCommandTest extends GenerateCommandTest
{
use CommandDataProviderTrait;
/**
* Command generator test
*
* @param $module
* @param $name
* @param $class
* @param $containerAware
*
* @dataProvider commandData
*/
public function testGenerateCommand(
$module,
$name,
$class,
$containerAware
) {
$command = new CommandCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--name' => $name,
'--class' => $class,
'--container-aware' => $containerAware
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\CommandGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,65 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorConfigFormBaseCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\ConfigFormBaseCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ConfigFormBaseDataProviderTrait;
class GeneratorConfigFormBaseCommandTest extends GenerateCommandTest
{
use ConfigFormBaseDataProviderTrait;
/**
* ConfigFormBase generator test
*
* @param $module
* @param $class_name
* @param $form_id
* @param $services
* @param $inputs
* @param $routing
*
* @dataProvider commandData
*/
public function testGenerateConfigFormBase(
$module,
$class_name,
$form_id,
$services,
$inputs,
$routing
) {
$command = new ConfigFormBaseCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--form-id' => $form_id,
'--services' => $services,
'--inputs' => $inputs
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\FormGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorControllerCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\ControllerCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ControllerDataProviderTrait;
class GeneratorControllerCommandTest extends GenerateCommandTest
{
use ControllerDataProviderTrait;
/**
* Controller generator test
*
* @param $module
* @param $class_name
* @param $routes
* @param $test
* @param $services
*
* @dataProvider commandData
*/
public function testGenerateController(
$module,
$class_name,
$routes,
$test,
$services
) {
$command = new ControllerCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--routes' => $routes,
'--test' => $test,
'--services' => $services,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\ControllerGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,60 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorEntityCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\EntityConfigCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\EntityDataProviderTrait;
class GeneratorEntityCommandTest extends GenerateCommandTest
{
use EntityDataProviderTrait;
/**
* EntityConfig generator test
*
* @param $module
* @param $entity_class
* @param $entity_name
* @param $label
*
* @dataProvider commandData
*/
public function testGenerateEntityConfig(
$module,
$entity_class,
$entity_name,
$label
) {
$command = new EntityConfigCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--entity-class' => $entity_class,
'--entity-name' => $entity_name,
'--label' => $label
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\EntityConfigGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorEntityConfigCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\EntityConfigCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\EntityConfigDataProviderTrait;
class GeneratorEntityConfigCommandTest extends GenerateCommandTest
{
use EntityConfigDataProviderTrait;
/**
* EntityConfig generator test
*
* @param $module
* @param $entity_name
* @param $entity_class
* @param $label
* @param $base_path
*
* @dataProvider commandData
*/
public function testGenerateEntityConfig(
$module,
$entity_name,
$entity_class,
$label,
$base_path
) {
$command = new EntityConfigCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--entity-name' => $entity_name,
'--entity-class' => $entity_class,
'--label' => $label,
'--base-path' => $base_path,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\EntityConfigGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorEntityContentCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\EntityContentCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\EntityContentDataProviderTrait;
class GeneratorEntityContentCommandTest extends GenerateCommandTest
{
use EntityContentDataProviderTrait;
/**
* EntityContent generator test
*
* @param $module
* @param $entity_name
* @param $entity_class
* @param $label
* @param $base_path
*
* @dataProvider commandData
*/
public function testGenerateEntityContent(
$module,
$entity_name,
$entity_class,
$label,
$base_path
) {
$command = new EntityContentCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--entity-name' => $entity_name,
'--entity-class' => $entity_class,
'--label' => $label,
'--base-path' => $base_path,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\EntityContentGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,74 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorFormCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\FormCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\FormDataProviderTrait;
class GeneratorFormCommandTest extends GenerateCommandTest
{
use FormDataProviderTrait;
/**
* Form generator test
*
* @param $module
* @param $class_name
* @param $services
* @param $inputs
* @param $form_id
* @param $routing_update
*
* @dataProvider commandData
*/
public function testGenerateForm(
$module,
$class_name,
$form_id,
$services,
$inputs,
$routing_update
) {
$command = $this->getGeneratorConfig();
$command->setHelperSet($this->getHelperSet(null));
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--services' => $services,
'--inputs' => $inputs,
'--form-id' => $form_id
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGeneratorConfig()
{
return $this
->getMockBuilder('Drupal\Console\Command\Generate\ConfigFormBaseCommand')
->setMethods(['getModules', 'getServices', '__construct'])
->setConstructorArgs([$this->getHelperSet()])
->getMock();
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\FormGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,55 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorJsTestCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\JsTestCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\JsTestDataProviderTrait;
class GeneratorJsTestCommandTest extends GenerateCommandTest
{
use JsTestDataProviderTrait;
/**
* JavaScript test command test
*
* @param $module
* @param $class_name
*
* @dataProvider commandData
*/
public function testCommandJsTest(
$module,
$class_name
) {
$command = new JsTestCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\JsTestGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,75 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorModuleCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\ModuleCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ModuleDataProviderTrait;
class GeneratorModuleCommandTest extends GenerateCommandTest
{
use ModuleDataProviderTrait;
/**
* Module generator test
*
* @param $module
* @param $machine_name
* @param $module_path
* @param $description
* @param $core
* @param $package
* @param $featuresBundle
* @param $composer
* @param $dependencies
*
* @dataProvider commandData
*/
public function testGenerateModule(
$module,
$machine_name,
$module_path,
$description,
$core,
$package,
$featuresBundle,
$composer,
$dependencies
) {
$command = new ModuleCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--machine-name' => $machine_name,
'--module-path' => $module_path,
'--description' => $description,
'--core' => $core,
'--package' => $package,
'--features-bundle'=> $featuresBundle,
'--composer' => $composer,
'--dependencies' => $dependencies
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\ModuleGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,54 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPermissionCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PermissionCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PermissionDataProviderTrait;
class GeneratorPermissionCommandTest extends GenerateCommandTest
{
use PermissionDataProviderTrait;
/**
* Permission generator test
*
* @param $module
* @param $permissions
*
* @dataProvider commandData
*/
public function testGeneratePermission(
$module,
$permissions
) {
$command = new PermissionCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--permissions' => $permissions,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PermissionGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginBlockCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginBlockCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginBlockDataProviderTrait;
class GeneratorPluginBlockCommandTest extends GenerateCommandTest
{
use PluginBlockDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
*
* @dataProvider commandData
*/
public function testGeneratePluginBlock(
$module,
$class_name,
$label,
$plugin_id,
$services,
$inputs
) {
$command = new PluginBlockCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$this->markTestIncomplete(
'This test has not been implemented yet.'
);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--services' => $services,
'--inputs' => $inputs
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginBlockGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,69 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginConditionCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginConditionCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginConditionDataProviderTrait;
class GeneratorPluginConditionCommandTest extends GenerateCommandTest
{
use PluginConditionDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $context_definition_id
* @param $context_definition_label
* @param $context_definition_required
*
* @dataProvider commandData
*/
public function testGeneratePluginCondition(
$module,
$class_name,
$label,
$plugin_id,
$context_definition_id,
$context_definition_label,
$context_definition_required
) {
$command = new PluginConditionCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--context-definition-id' => $context_definition_id,
'--context-definition-label' => $context_definition_label,
'--context-definition-required' => $context_definition_required
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginConditionGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,90 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginFieldCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginFieldCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginFieldDataProviderTrait;
class GeneratorPluginFieldCommandTest extends GenerateCommandTest
{
use PluginFieldDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $type_class_name
* @param $type_label
* @param $type_plugin_id
* @param $type_description
* @param $formatter_class_name
* @param $formatter_label
* @param $formatter_plugin_id
* @param $widget_class_name
* @param $widget_label
* @param $widget_plugin_id
* @param $field_type
* @param $default_widget
* @param $default_formatter
*
* @dataProvider commandData
*/
public function testGeneratePluginField(
$module,
$type_class_name,
$type_label,
$type_plugin_id,
$type_description,
$formatter_class_name,
$formatter_label,
$formatter_plugin_id,
$widget_class_name,
$widget_label,
$widget_plugin_id,
$field_type,
$default_widget,
$default_formatter
) {
$command = new PluginFieldCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--type-class' => $type_class_name,
'--type-label' => $type_label,
'--type-plugin-id' => $type_plugin_id,
'--type-description' => $type_description,
'--formatter-class' => $formatter_class_name,
'--formatter-label' => $formatter_label,
'--formatter-plugin-id' => $formatter_plugin_id,
'--widget-class' => $widget_class_name,
'--widget-label' => $widget_label,
'--widget-plugin-id' => $widget_plugin_id,
'--field-type' => $field_type,
'--default-widget' => $default_widget,
'--default-formatter' => $default_formatter
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginFieldTypeGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginFieldFormatterCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginFieldFormatterCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginFieldFormatterDataProviderTrait;
class GeneratorPluginFieldFormatterCommandTest extends GenerateCommandTest
{
use PluginFieldFormatterDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $field_type
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldFormatter(
$module,
$class_name,
$label,
$plugin_id,
$field_type
) {
$command = new PluginFieldFormatterCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--field-type' => $field_type
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginFieldFormatterGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,69 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginFieldTypeCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginFieldTypeCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginFieldTypeDataProviderTrait;
class GeneratorPluginFieldTypeCommandTest extends GenerateCommandTest
{
use PluginFieldTypeDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $description
* @param $default_widget
* @param $default_formatter
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldType(
$module,
$class_name,
$label,
$plugin_id,
$description,
$default_widget,
$default_formatter
) {
$command = new PluginFieldTypeCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--description' => $description,
'--default-widget' => $default_widget,
'--default-formatter' => $default_formatter
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginFieldTypeGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginFieldWidgetCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginFieldWidgetCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginFieldWidgetDataProviderTrait;
class GeneratorPluginFieldWidgetCommandTest extends GenerateCommandTest
{
use PluginFieldWidgetDataProviderTrait;
/**
* Plugin block generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $field_type
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldWidget(
$module,
$class_name,
$label,
$plugin_id,
$field_type
) {
$command = new PluginFieldWidgetCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--field-type' => $field_type
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginFieldWidgetGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginImageEffectCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginImageEffectCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginImageEffectDataProviderTrait;
class GeneratorPluginImageEffectCommandTest extends GenerateCommandTest
{
use PluginImageEffectDataProviderTrait;
/**
* Plugin image effect generator test
*
* @param $module
* @param $class_name
* @param $plugin_label
* @param $plugin_id
* @param $description
*
* @dataProvider commandData
*/
public function testGeneratePluginImageEffect(
$module,
$class_name,
$plugin_label,
$plugin_id,
$description
) {
$command = new PluginImageEffectCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $plugin_label,
'--plugin-id' => $plugin_id,
'--description' => $description
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginImageEffectGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,61 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginImageFormatterCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginImageFormatterCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginImageFormatterDataProviderTrait;
class GeneratorPluginImageFormatterCommandTest extends GenerateCommandTest
{
use PluginImageFormatterDataProviderTrait;
/**
* Plugin image effect generator test
*
* @param $module
* @param $class_name
* @param $plugin_label
* @param $plugin_id
* @param $description
*
* @dataProvider commandData
*/
public function testGeneratePluginImageFormatter(
$module,
$class_name,
$plugin_label,
$plugin_id
) {
$command = new PluginImageFormatterCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $plugin_label,
'--plugin-id' => $plugin_id
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginImageFormatterGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,66 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginRestResourceCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginRestResourceCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginRestResourceDataProviderTrait;
class GeneratorPluginRestResourceCommandTest extends GenerateCommandTest
{
use PluginRestResourceDataProviderTrait;
/**
* Plugin rest resource generator test
*
* @param $module
* @param $class_name
* @param $plugin_id
* @param $plugin_label
* @param $plugin_url
* @param $plugin_states
*
* @dataProvider commandData
*/
public function testGeneratePluginRestResource(
$module,
$class_name,
$plugin_id,
$plugin_label,
$plugin_url,
$plugin_states
) {
$command = new PluginRestResourceCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--plugin-id' => $plugin_id,
'--plugin-label' => $plugin_label,
'--plugin-url' => $plugin_url,
'--plugin-states' => $plugin_states,
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginRestResourceGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,69 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginRulesActionCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginRulesActionCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginRulesActionDataProviderTrait;
class GeneratorPluginRulesActionCommandTest extends GenerateCommandTest
{
use PluginRulesActionDataProviderTrait;
/**
* Plugin rules action generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $category
* @param $context
* @param $type
*
* @dataProvider commandData
*/
public function testGeneratePluginRulesAction(
$module,
$class_name,
$label,
$plugin_id,
$category,
$context,
$type
) {
$command = new PluginRulesActionCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--label' => $label,
'--plugin-id' => $plugin_id,
'--category' => $category,
'--context' => $context,
'--type' => $type
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginRulesActionGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,60 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginTypeAnnotationCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginTypeAnnotationCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginTypeYamlDataProviderTrait;
class GeneratorPluginTypeAnnotationCommandTest extends GenerateCommandTest
{
use PluginTypeYamlDataProviderTrait;
/**
* Plugin type yaml generator test
*
* @param $module
* @param $class_name
* @param $machine_name
* @param $label
*
* @dataProvider commandData
*/
public function testGeneratePluginTypeYaml(
$module,
$class_name,
$machine_name,
$label
) {
$command = new PluginTypeAnnotationCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $class_name,
'--machine-name' => $machine_name,
'--label' => $label
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginTypeYamlGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,60 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Command\GeneratorPluginTypeYamlCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\PluginTypeYamlCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\PluginTypeYamlDataProviderTrait;
class GeneratorPluginTypeYamlCommandTest extends GenerateCommandTest
{
use PluginTypeYamlDataProviderTrait;
/**
* Plugin type yaml generator test
*
* @param $module
* @param $plugin_class
* @param $plugin_name
* @param $plugin_file_name
*
* @dataProvider commandData
*/
public function testGeneratePluginTypeYaml(
$module,
$plugin_class,
$plugin_name,
$plugin_file_name
) {
$command = new PluginTypeYamlCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--module' => $module,
'--class' => $plugin_class,
'--plugin-name' => $plugin_name,
'--plugin-file-name' => $plugin_file_name
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\PluginTypeYamlGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,78 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Command\GeneratorThemeCommandTest.
*/
namespace Drupal\Console\Test\Command;
use Drupal\Console\Command\Generate\ThemeCommand;
use Symfony\Component\Console\Tester\CommandTester;
use Drupal\Console\Test\DataProvider\ThemeDataProviderTrait;
class GeneratorThemeCommandTest extends GenerateCommandTest
{
use ThemeDataProviderTrait;
/**
* Theme generator test
*
* @param $theme
* @param $machine_name
* @param $theme_path
* @param $description
* @param $core
* @param $package
* @param $global_library
* @param $base_theme
* @param $regions
* @param $breakpoints
*
* @dataProvider commandData
*/
public function testGenerateTheme(
$theme,
$machine_name,
$theme_path,
$description,
$core,
$package,
$global_library,
$base_theme,
$regions,
$breakpoints
) {
$command = new ThemeCommand($this->getHelperSet());
$command->setHelperSet($this->getHelperSet());
$command->setGenerator($this->getGenerator());
$commandTester = new CommandTester($command);
$code = $commandTester->execute(
[
'--theme' => $theme,
'--machine-name' => $machine_name,
'--theme-path' => $theme_path,
'--description' => $description,
'--core' => $core,
'--package' => $package,
'--global-library' => $global_library,
'--base-theme' => $base_theme,
'--regions' => $regions,
'--breakpoints' => $breakpoints
],
['interactive' => false]
);
$this->assertEquals(0, $code);
}
private function getGenerator()
{
return $this
->getMockBuilder('Drupal\Console\Generator\ThemeGenerator')
->disableOriginalConstructor()
->setMethods(['generate'])
->getMock();
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class AuthenticationProviderDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait AuthenticationProviderDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 0],
];
}
}

View file

@ -0,0 +1,23 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class CommandDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait CommandDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['command_' . rand(), 'command:default', 'CommandDefault', false],
['command_' . rand(), 'command:default', 'CommandDefault', true]
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class ConfigFormBaseDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait ConfigFormBaseDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'Bar', null, null, 'ConfigFormBase', null, true, 'Foo', 'system.admin_config_development', 'foo'],
];
}
}

View file

@ -0,0 +1,27 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class ControllerDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait ControllerDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
$routes = [
['title' => 'Foo Controller', 'name' => 'custom.default_controller_hello', 'method' => 'index', 'path' => '/hello/{name}']
];
return [
['foo', 'FooController', $routes, true, null, 'foo_controller'],
['foo', 'FooController', $routes, false, null, 'foo_controller'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class EntityBundleDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait EntityBundleDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['foo', 'default_type', 'default']
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class EntityConfigDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait EntityConfigDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'Bar', '', 'bar', 'admin/structure'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class EntityContentDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait EntityContentDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'Bar', 'bar', 'admin/structure', 'true', true],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class EntityDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait EntityDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'Bar', 'foo' . rand(), 'bar', 'admin/structure'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class FormDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait FormDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'id' . rand(), null, null, 'FormBase', '/form/path', true, 'foo', 'system.admin_config_development', 'foo']
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class JsTestDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait JsTestDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['foo', 'JsFooTest'],
];
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class ModuleDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait ModuleDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', sprintf('%s_%s', 'foo', rand()), $this->dir, 'Description', '8.x', 'Custom', true, '', false, null],
['Foo', sprintf('%s_%s', 'foo', rand()), $this->dir, 'Description', '8.x', 'Custom', false, 'default', false, null],
['Foo', sprintf('%s_%s', 'foo', rand()), $this->dir, 'Description', '8.x', 'Custom', true, '', false, null],
['Foo', sprintf('%s_%s', 'foo', rand()), $this->dir, 'Description', '8.x', 'Custom', false, '', false, null],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PermissionDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PermissionDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'my permissions'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginBlockDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginBlockDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'foo', 'bar', null, '', 'inputs'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginCKEditorButtonDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginCKEditorButtonDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'foo', 'bar', 'Baz', 'foo/js/pluggin/bar/images/icon.png'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginConditionDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginConditionDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'foo', 'bar-id', 'foo-context-id', 'foo-context-label', false]
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginFieldDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginFieldDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'foo', 'foo-bar', 'foo-bar', 'bar', 'Foo-Bar', 'foo-bar', 'foo-bar', 'bar', 'Foo-Bar', 'foo-bar', 'foo-bar', 'bar']
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginFieldFormatterDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginFieldFormatterDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'bar', 'bar' . rand(), 'foo-bar']
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginFieldTypeDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginFieldTypeDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'foo', 'foo-bar', 'foo-bar', 'bar', 'Foo-Bar']
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginFieldWidgetDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginFieldWidgetDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'foo', 'foo-bar', 'Foo-Bar']
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginImageEffectkDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginImageEffectDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'foo', 'bar', 'description'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginImageFormatterkDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginImageFormatterDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'foo', 'bar'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginRestResourceDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginRestResourceDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'Foo', 'pluginID' . rand(), 'url', 'states'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginRulesActionDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginRulesActionDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'Foo', 'pluginID' . rand(), 'category', 'context', 'bar'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginTypeAnnotationDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginTypeAnnotationDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'MyPlugin', 'my_plugin', 'my.plugin'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class PluginTypeYamlDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait PluginTypeYamlDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'MyPlugin', 'my_plugin', 'my.plugin'],
];
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class ProfileDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait ProfileDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
// Profile name, machine name, description, core version,
// dependencies, distribution name.
['Foo', 'foo' . rand(), $this->dir . '/profiles', 'Description', '8.x', null, false],
['Foo', 'foo' . rand(), $this->dir . '/profiles', 'Description', '8.x', null, 'Bar'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class ServiceDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait ServiceDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', 'foo' . rand(), 'Foo', false, [],'default'],
];
}
}

View file

@ -0,0 +1,22 @@
<?php
namespace Drupal\Console\Test\DataProvider;
/**
* Class ThemeDataProviderTrait
* @package Drupal\Console\Test\DataProvider
*/
trait ThemeDataProviderTrait
{
/**
* @return array
*/
public function commandData()
{
$this->setUpTemporaryDirectory();
return [
['Foo', rand(), $this->dir.'/themes/custom', 'bar', 'Other', '8.x', 'sd', 'global-styling', false, false]
];
}
}

View file

@ -0,0 +1,53 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\AuthenticationProviderGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\AuthenticationProviderGenerator;
use Drupal\Console\Test\DataProvider\AuthenticationProviderDataProviderTrait;
class AuthenticationProviderGeneratorTest extends GeneratorTest
{
use AuthenticationProviderDataProviderTrait;
/**
* AuthenticationProvider generator test
*
* @param $module
* @param $class_name
*
* @dataProvider commandData
*/
public function testGenerateAuthenticationProvider(
$module,
$class_name,
$provider_id
) {
$generator = new AuthenticationProviderGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$provider_id
);
$files = [
$generator->getSite()->getAuthenticationPath($module, 'Provider').'/'.$class_name.'.php',
$generator->getSite()->getModulePath($module).'/'.$module.'.services.yml'
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,43 @@
<?php
/**
* @file
* Contains \Drupal\Console\Test\Generator\CommandGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\CommandGenerator;
use Drupal\Console\Test\DataProvider\CommandDataProviderTrait;
class CommandGeneratorTest extends GeneratorTest
{
use CommandDataProviderTrait;
/**
* @param $module
* @param $name
* @param $class
* @param $containerAware
*
* @dataProvider commandData
*/
public function testGenerateCommand(
$module,
$name,
$class,
$containerAware
) {
$generator = new CommandGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$name,
$class,
$containerAware
);
}
}

View file

@ -0,0 +1,78 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\ConfigFormBaseGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\FormGenerator;
use Drupal\Console\Test\DataProvider\ConfigFormBaseDataProviderTrait;
class ConfigFormBaseGeneratorTest extends GeneratorTest
{
use ConfigFormBaseDataProviderTrait;
/**
* Form generator test
*
* @param $module
* @param $class_name
* @param $services
* @param $inputs
* @param $form_id
* @param $form_type
* @param $path
* @param $menu_link_gen
* @param $menu_link_title
* @param $menu_parent
* @param $menu_link_desc
*
* @dataProvider commandData
*/
public function testGenerateConfigFormBase(
$module,
$class_name,
$services,
$inputs,
$form_id,
$form_type,
$path,
$menu_link_gen,
$menu_link_title,
$menu_parent,
$menu_link_desc
) {
$generator = new FormGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$services,
$inputs,
$form_id,
$form_type,
$path,
$menu_link_gen,
$menu_link_title,
$menu_parent,
$menu_link_desc
);
$this->assertTrue(
file_exists($generator->getSite()->getFormPath($module).'/'.$class_name.'.php'),
sprintf('%s does not exist', $class_name.'.php')
);
if ($path) {
$this->assertTrue(
file_exists($generator->getSite()->getModulePath($module).'/'.$module.'.routing.yml'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}
}

View file

@ -0,0 +1,57 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\EntityBundleGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\EntityBundleGenerator;
use Drupal\Console\Test\DataProvider\EntityBundleDataProviderTrait;
class ContentTypeGeneratorTest extends GeneratorTest
{
use EntityBundleDataProviderTrait;
/**
* ContentType generator test
*
* @param $module
* @param $bundle_name
* @param $bundle_title
*
* @dataProvider commandData
*/
public function testGenerateContentType(
$module,
$bundle_name,
$bundle_title
) {
$generator = new EntityBundleGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$bundle_name,
$bundle_title
);
$files = [
$generator->getSite()->getModulePath($module) . '/config/install/core.entity_form_display.node.' . $bundle_name . '.default.yml',
$generator->getSite()->getModulePath($module) . '/config/install/core.entity_view_display.node.' . $bundle_name . '.default.yml',
$generator->getSite()->getModulePath($module) . '/config/install/core.entity_view_display.node.' . $bundle_name . '.teaser.yml',
$generator->getSite()->getModulePath($module) . '/config/install/field.field.node.' . $bundle_name . '.body.yml',
$generator->getSite()->getModulePath($module) . '/config/install/node.type.' . $bundle_name . '.yml',
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,68 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\ControllerGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\ControllerGenerator;
use Drupal\Console\Test\DataProvider\ControllerDataProviderTrait;
class ControllerGeneratorTest extends GeneratorTest
{
use ControllerDataProviderTrait;
/**
* Controller generator test
*
* @param $module
* @param $class_name
* @param $routes
* @param $test
* @param $build_services
* @param $class_machine_name
*
* @dataProvider commandData
*/
public function testGenerateController(
$module,
$class_name,
$routes,
$test,
$build_services
) {
$generator = new ControllerGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$routes,
$test,
$build_services
);
$files = [
$generator->getSite()->getControllerPath($module).'/'.$class_name.'.php',
$generator->getSite()->getModulePath($module).'/'.$module.'.routing.yml'
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
if ($test) {
$this->assertTrue(
file_exists($generator->getSite()->getTestPath($module, 'Controller') . '/' . $class_name.'Test.php'),
sprintf('%s does not exist', $class_name.'Test.php')
);
}
}
}

View file

@ -0,0 +1,67 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\EntityConfigGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\EntityConfigGenerator;
use Drupal\Console\Test\DataProvider\EntityConfigDataProviderTrait;
class EntityConfigGeneratorTest extends GeneratorTest
{
use EntityConfigDataProviderTrait;
/**
* EntityConfig generator test
*
* @param $module
* @param $entity_name
* @param $entity_class
* @param $label
* @param $base_path
*
* @dataProvider commandData
*/
public function testGenerateEntityConfig(
$module,
$entity_name,
$entity_class,
$label,
$base_path
) {
$generator = new EntityConfigGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$entity_name,
$entity_class,
$label,
$base_path
);
$files = [
$generator->getSite()->getModulePath($module).'/config/schema/'.$entity_name.'.schema.yml',
$generator->getSite()->getModulePath($module).'/'.$module.'.links.menu.yml',
$generator->getSite()->getModulePath($module).'/'.$module.'.links.action.yml',
$generator->getSite()->getEntityPath($module).'/'.$entity_class.'Interface.php',
$generator->getSite()->getEntityPath($module).'/'.$entity_class.'.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'Form.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'DeleteForm.php',
$generator->getSite()->getSourcePath($module).'/'.$entity_class.'HtmlRouteProvider.php',
$generator->getSite()->getSourcePath($module).'/'.$entity_class.'ListBuilder.php'
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,86 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\EntityContentGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\EntityContentGenerator;
use Drupal\Console\Test\DataProvider\EntityContentDataProviderTrait;
class EntityContentGeneratorTest extends GeneratorTest
{
use EntityContentDataProviderTrait;
/**
* EntityContent generator test
*
* @param $module
* @param $entity_name
* @param $entity_class
* @param $label
* @param $base_path
* @param $is_translatable
* @param $revisionable
*
* @dataProvider commandData
*/
public function testGenerateEntityContent(
$module,
$entity_name,
$entity_class,
$label,
$base_path,
$is_translatable,
$revisionable
) {
$generator = new EntityContentGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$entity_name,
$entity_class,
$label,
$base_path,
$is_translatable,
null,
$revisionable
);
$files = [
$generator->getSite()->getModulePath($module).'/'.$module.'.permissions.yml',
$generator->getSite()->getModulePath($module).'/'.$module.'.links.menu.yml',
$generator->getSite()->getModulePath($module).'/'.$module.'.links.task.yml',
$generator->getSite()->getModulePath($module).'/'.$module.'.links.action.yml',
$generator->getSite()->getEntityPath($module).'/'.$entity_class.'Interface.php',
$generator->getSite()->getEntityPath($module).'/'.$entity_class.'.php',
$generator->getSite()->getEntityPath($module).'/'.$entity_class.'ViewsData.php',
$generator->getSite()->getSourcePath($module).'/'.$entity_class.'AccessControlHandler.php',
$generator->getSite()->getSourcePath($module).'/'.$entity_class.'HtmlRouteProvider.php',
$generator->getSite()->getSourcePath($module).'/'.$entity_class.'ListBuilder.php',
$generator->getSite()->getSourcePath($module).'/'.$entity_class.'Storage.php',
$generator->getSite()->getSourcePath($module).'/'.$entity_class.'StorageInterface.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'SettingsForm.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'Form.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'DeleteForm.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'RevisionDeleteForm.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'RevisionRevertTranslationForm.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'RevisionRevertForm.php',
$generator->getSite()->getControllerPath($module).'/'.$entity_class.'Controller.php',
$generator->getSite()->getModulePath($module).'/'.$entity_name.'.page.inc',
$generator->getSite()->getTemplatePath($module).'/'.$entity_name.'.html.twig',
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,67 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\EntityGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\EntityConfigGenerator;
use Drupal\Console\Test\DataProvider\EntityDataProviderTrait;
class EntityGeneratorTest extends GeneratorTest
{
use EntityDataProviderTrait;
/**
* EntityConfig generator test
*
* @param $module
* @param $entity_name
* @param $entity_class
* @param $label
* @param $base_path
*
* @dataProvider commandData
*/
public function testGenerateEntity(
$module,
$entity_name,
$entity_class,
$label,
$base_path
) {
$generator = new EntityConfigGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$entity_name,
$entity_class,
$label,
$base_path
);
$files = [
$generator->getSite()->getModulePath($module).'/config/schema/'.$entity_name.'.schema.yml',
$generator->getSite()->getModulePath($module).'/'.$module.'.links.menu.yml',
$generator->getSite()->getModulePath($module).'/'.$module.'.links.action.yml',
$generator->getSite()->getEntityPath($module).'/'.$entity_class.'Interface.php',
$generator->getSite()->getEntityPath($module).'/'.$entity_class.'.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'Form.php',
$generator->getSite()->getFormPath($module).'/'.$entity_class.'DeleteForm.php',
$generator->getSite()->getSourcePath($module).'/'.$entity_class.'HtmlRouteProvider.php',
$generator->getSite()->getSourcePath($module).'/'.$entity_class.'ListBuilder.php'
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,78 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\FormGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\FormGenerator;
use Drupal\Console\Test\DataProvider\FormDataProviderTrait;
class FormGeneratorTest extends GeneratorTest
{
use FormDataProviderTrait;
/**
* Form generator test
*
* @param $module
* @param $class_name
* @param $services
* @param $inputs
* @param $form_id
* @param $form_type
* @param $path
* @param $menu_link_gen
* @param $menu_link_title
* @param $menu_parent
* @param $menu_link_desc
*
* @dataProvider commandData
*/
public function testGenerateForm(
$module,
$class_name,
$services,
$inputs,
$form_id,
$form_type,
$path,
$menu_link_gen,
$menu_link_title,
$menu_parent,
$menu_link_desc
) {
$generator = new FormGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$services,
$inputs,
$form_id,
$form_type,
$path,
$menu_link_gen,
$menu_link_title,
$menu_parent,
$menu_link_desc
);
$this->assertTrue(
file_exists($generator->getSite()->getFormPath($module).'/'.$class_name.'.php'),
sprintf('%s does not exist', $class_name.'.php')
);
if ($path) {
$this->assertTrue(
file_exists($generator->getSite()->getModulePath($module).'/'.$module.'.routing.yml'),
sprintf('%s does not exist', $module.'.routing.yml')
);
}
}
}

View file

@ -0,0 +1,19 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\GeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Test\BaseTestCase;
abstract class GeneratorTest extends BaseTestCase
{
public function getSkeletonDirs()
{
$skeletonDirs[] = __DIR__ . '/../../templates';
return $skeletonDirs;
}
}

View file

@ -0,0 +1,50 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\JsTestGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\JsTestGenerator;
use Drupal\Console\Test\DataProvider\JsTestDataProviderTrait;
class JsTestGeneratorTest extends GeneratorTest
{
use JsTestDataProviderTrait;
/**
* JavaScript test generator test
*
* @param $module
* @param $class_name
*
* @dataProvider commandData
*/
public function testGenerateJsTest(
$module,
$class_name
) {
$generator = new JsTestGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name
);
$files = [
$generator->getSite()->getJsTestsPath($module) . "/$class_name.php",
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,85 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\ModuleGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\ModuleGenerator;
use Drupal\Console\Test\DataProvider\ModuleDataProviderTrait;
/**
* Class ModuleGeneratorTest
* @package Drupal\Console\Test\Generator
*/
class ModuleGeneratorTest extends GeneratorTest
{
use ModuleDataProviderTrait;
/**
* Module generator test
*
* @param $module
* @param $machine_name
* @param $module_path,
* @param $description
* @param $core
* @param $package
* @param $moduleFile
* @param $featureBundle
* @param $composer
* @param $dependencies
*
* @dataProvider commandData
*/
public function testGenerateModule(
$module,
$machine_name,
$module_path,
$description,
$core,
$package,
$moduleFile,
$featureBundle,
$composer,
$dependencies
) {
$generator = new ModuleGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$machine_name,
$module_path,
$description,
$core,
$package,
$moduleFile,
$featureBundle,
$composer,
$dependencies
);
$this->assertTrue(
file_exists($module_path . '/' . $machine_name . '/' . $machine_name . '.info.yml'),
sprintf('%s has been generated', $module_path . '/' . $machine_name . '.info.yml')
);
if ($moduleFile) {
$this->assertTrue(
file_exists($module_path . '/' . $machine_name . '/' . $machine_name . '.module'),
sprintf('%s has been generated', $module_path . '/' . $machine_name . '/' . $machine_name . '.module')
);
}
if ($composer) {
$this->assertTrue(
file_exists($module_path . '/' . $machine_name . '/composer.json'),
sprintf('%s has been generated', $module_path . '/' . $machine_name . '/composer.json')
);
}
}
}

View file

@ -0,0 +1,44 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PermissionGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PermissionGenerator;
use Drupal\Console\Test\DataProvider\PermissionDataProviderTrait;
class PermissionGeneratorTest extends GeneratorTest
{
use PermissionDataProviderTrait;
/**
* Permission generator test
*
* @param $module
* @param $permissions
*
* @dataProvider commandData
*/
public function testGeneratePermission(
$module,
$permissions
) {
$generator = new PermissionGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$permissions
);
$this->assertTrue(
file_exists($generator->getSite()->getModulePath($module).'/'.$module.'.permissions.yml'),
sprintf('%s does not exist', $module.'.permissions.yml')
);
}
}

View file

@ -0,0 +1,56 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginBlockGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginBlockGenerator;
use Drupal\Console\Test\DataProvider\PluginBlockDataProviderTrait;
class PluginBlockGeneratorTest extends GeneratorTest
{
use PluginBlockDataProviderTrait;
/**
* PluginBlock generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $services
* @param $inputs
*
* @dataProvider commandData
*/
public function testGeneratePluginBlock(
$module,
$class_name,
$label,
$plugin_id,
$services,
$inputs
) {
$generator = new PluginBlockGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$label,
$plugin_id,
$services,
$inputs
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'Block').'/'.$class_name.'.php'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}

View file

@ -0,0 +1,55 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginCKEditorButtonGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginCKEditorButtonGenerator;
use Drupal\Console\Test\DataProvider\PluginCKEditorButtonDataProviderTrait;
class PluginCKEditorButtonGeneratorTest extends GeneratorTest
{
use PluginCKEditorButtonDataProviderTrait;
/**
* PluginCKEditorButton generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $button_name
* @param $button_icon_path
*
* @dataProvider commandData
*/
public function testGenerateCKEditorButtonEffect(
$module,
$class_name,
$label,
$plugin_id,
$button_name,
$button_icon_path
) {
$generator = new PluginCKEditorButtonGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$label,
$plugin_id,
$button_name,
$button_icon_path
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'CKEditorPlugin').'/'.$class_name.'.php'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}

View file

@ -0,0 +1,59 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginConditionGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginConditionGenerator;
use Drupal\Console\Test\DataProvider\PluginConditionDataProviderTrait;
class PluginConditionGeneratorTest extends GeneratorTest
{
use PluginConditionDataProviderTrait;
/**
* PluginCondition generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $context_definition_id
* @param $context_definition_label
* @param $context_definition_required
*
* @dataProvider commandData
*/
public function testGeneratePluginCondition(
$module,
$class_name,
$label,
$plugin_id,
$context_definition_id,
$context_definition_label,
$context_definition_required
) {
$generator = new PluginConditionGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$label,
$plugin_id,
$context_definition_id,
$context_definition_label,
$context_definition_required
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'Condition') . '/' . $class_name . '.php'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}

View file

@ -0,0 +1,53 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginFieldFormatterGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginFieldFormatterGenerator;
use Drupal\Console\Test\DataProvider\PluginFieldFormatterDataProviderTrait;
class PluginFieldFormatterGeneratorTest extends GeneratorTest
{
use PluginFieldFormatterDataProviderTrait;
/**
* PluginFieldFormatter generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $field_type
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldFormatter(
$module,
$class_name,
$label,
$plugin_id,
$field_type
) {
$generator = new PluginFieldFormatterGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$label,
$plugin_id,
$field_type
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}

View file

@ -0,0 +1,80 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginFieldGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginFieldTypeGenerator;
use Drupal\Console\Test\DataProvider\PluginFieldDataProviderTrait;
class PluginFieldGeneratorTest extends GeneratorTest
{
use PluginFieldDataProviderTrait;
/**
* PluginField generator test
*
* @param $module
* @param $type_class_name
* @param $type_label
* @param $type_plugin_id
* @param $type_description
* @param $formatter_class_name
* @param $formatter_label
* @param $formatter_plugin_id
* @param $widget_class_name
* @param $widget_label
* @param $widget_plugin_id
* @param $field_type
* @param $default_widget
* @param $default_formatter
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldType(
$module,
$type_class_name,
$type_label,
$type_plugin_id,
$type_description,
$formatter_class_name,
$formatter_label,
$formatter_plugin_id,
$widget_class_name,
$widget_label,
$widget_plugin_id,
$field_type,
$default_widget,
$default_formatter
) {
$generator = new PluginFieldTypeGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$type_class_name,
$type_label,
$type_plugin_id,
$type_description,
$formatter_class_name,
$formatter_label,
$formatter_plugin_id,
$widget_class_name,
$widget_label,
$widget_plugin_id,
$field_type,
$default_widget,
$default_formatter
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'Field/FieldType') . '/' . $type_class_name . '.php'),
sprintf('%s does not exist', $type_class_name.'.php')
);
}
}

View file

@ -0,0 +1,59 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginFieldTypeGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginFieldTypeGenerator;
use Drupal\Console\Test\DataProvider\PluginFieldTypeDataProviderTrait;
class PluginFieldTypeGeneratorTest extends GeneratorTest
{
use PluginFieldTypeDataProviderTrait;
/**
* PluginFieldType generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $description
* @param $default_widget
* @param $default_formatter
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldType(
$module,
$class_name,
$label,
$plugin_id,
$description,
$default_widget,
$default_formatter
) {
$generator = new PluginFieldTypeGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$label,
$plugin_id,
$description,
$default_widget,
$default_formatter
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'Field/FieldType') . '/' . $class_name . '.php'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}

View file

@ -0,0 +1,53 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginFieldWidgetGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginFieldWidgetGenerator;
use Drupal\Console\Test\DataProvider\PluginFieldWidgetDataProviderTrait;
class PluginFieldWidgetGeneratorTest extends GeneratorTest
{
use PluginFieldWidgetDataProviderTrait;
/**
* PluginFieldWidget generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $field_type
*
* @dataProvider commandData
*/
public function testGeneratePluginFieldWidget(
$module,
$class_name,
$label,
$plugin_id,
$field_type
) {
$generator = new PluginFieldWidgetGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$label,
$plugin_id,
$field_type
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'Field/FieldWidget') . '/' . $class_name . '.php'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}

View file

@ -0,0 +1,52 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginImageEffectGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginImageEffectGenerator;
use Drupal\Console\Test\DataProvider\PluginImageEffectDataProviderTrait;
class PluginImageEffectGeneratorTest extends GeneratorTest
{
use PluginImageEffectDataProviderTrait;
/**
* PluginImageEffect generator test
*
* @param $module
* @param $class_name
* @param $plugin_label
* @param $plugin_id
* @param $description
*
* @dataProvider commandData
*/
public function testGeneratePluginImageEffect(
$module,
$class_name,
$label,
$plugin_id,
$description
) {
$generator = new PluginImageEffectGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$label,
$plugin_id,
$description
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'ImageEffect').'/'.$class_name.'.php'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}

View file

@ -0,0 +1,49 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginImageFormatterGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginImageFormatterGenerator;
use Drupal\Console\Test\DataProvider\PluginImageFormatterDataProviderTrait;
class PluginImageFormatterGeneratorTest extends GeneratorTest
{
use PluginImageFormatterDataProviderTrait;
/**
* PluginImageFormatter generator test
*
* @param $module
* @param $class_name
* @param $plugin_label
* @param $plugin_id
*
* @dataProvider commandData
*/
public function testGeneratePluginImageFormatter(
$module,
$class_name,
$label,
$plugin_id
) {
$generator = new PluginImageFormatterGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$label,
$plugin_id
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'Field/FieldFormatter') . '/' . $class_name . '.php'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}

View file

@ -0,0 +1,55 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginRestResourceGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginRestResourceGenerator;
use Drupal\Console\Test\DataProvider\PluginRestResourceDataProviderTrait;
class PluginRestResourceGeneratorTest extends GeneratorTest
{
use PluginRestResourceDataProviderTrait;
/**
* PluginRestResource generator test
*
* @param $module
* @param $class_name
* @param $plugin_label
* @param $plugin_id
* @param $plugin_url
* @param $plugin_states
*
* @dataProvider commandData
*/
public function testGeneratePluginRestResource(
$module,
$class_name,
$plugin_label,
$plugin_id,
$plugin_url,
$plugin_states
) {
$generator = new PluginRestResourceGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$plugin_label,
$plugin_id,
$plugin_url,
$plugin_states
);
$this->assertTrue(
file_exists($generator->getSite()->getPluginPath($module, 'rest').'/resource/'.$class_name.'.php'),
sprintf('%s does not exist', $class_name.'.php')
);
}
}

View file

@ -0,0 +1,65 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginRulesActionGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginRulesActionGenerator;
use Drupal\Console\Test\DataProvider\PluginRulesActionDataProviderTrait;
class PluginRulesActionGeneratorTest extends GeneratorTest
{
use PluginRulesActionDataProviderTrait;
/**
* PluginRulesAction generator test
*
* @param $module
* @param $class_name
* @param $label
* @param $plugin_id
* @param $category
* @param $context,
* @param $type
*
* @dataProvider commandData
*/
public function testGeneratePluginRulesAction(
$module,
$class_name,
$label,
$plugin_id,
$category,
$context,
$type
) {
$generator = new PluginRulesActionGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$label,
$plugin_id,
$category,
$context,
$type
);
$files = [
$generator->getSite()->getPluginPath($module, 'Action').'/'.$class_name.'.php',
$generator->getSite()->getModulePath($module).'/config/install/system.action.'.$plugin_id.'.yml'
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,59 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginTypeAnnotationGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginTypeAnnotationGenerator;
use Drupal\Console\Test\DataProvider\PluginTypeAnnotationDataProviderTrait;
class PluginTypeAnnotationGeneratorTest extends GeneratorTest
{
use PluginTypeAnnotationDataProviderTrait;
/**
* PluginTypeAnnotation generator test
*
* @param $module
* @param $class_name
* @param $machine_name
* @param $label
*
* @dataProvider commandData
*/
public function testGeneratePluginTypeAnnotation(
$module,
$class_name,
$machine_name,
$label
) {
$generator = new PluginTypeAnnotationGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$class_name,
$machine_name,
$label
);
$files = [
$generator->getSite()->getSourcePath($module) . '/Annotation/' . $class_name . '.php',
$generator->getSite()->getSourcePath($module).'/Plugin/' . $class_name . 'Base.php',
$generator->getSite()->getSourcePath($module).'/Plugin/' . $class_name . 'Interface.php',
$generator->getSite()->getSourcePath($module).'/Plugin/' . $class_name . 'Manager.php',
$generator->getSite()->getModulePath($module) . '/' . $module . '.services.yml'
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,58 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\PluginTypeYamlGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\PluginTypeYamlGenerator;
use Drupal\Console\Test\DataProvider\PluginTypeYamlDataProviderTrait;
class PluginTypeYamlGeneratorTest extends GeneratorTest
{
use PluginTypeYamlDataProviderTrait;
/**
* PluginTypeYaml generator test
*
* @param $module
* @param $plugin_class
* @param $plugin_name
* @param $plugin_file_name
*
* @dataProvider commandData
*/
public function testGeneratePluginTypeYaml(
$module,
$plugin_class,
$plugin_name,
$plugin_file_name
) {
$generator = new PluginTypeYamlGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$plugin_class,
$plugin_name,
$plugin_file_name
);
$files = [
$generator->getSite()->getSourcePath($module) . '/' . $plugin_class . 'Manager.php',
$generator->getSite()->getSourcePath($module) . '/' . $plugin_class . 'ManagerInterface.php',
$generator->getSite()->getModulePath($module) . '/' . $module . '.services.yml',
$generator->getSite()->getModulePath($module) . '/' . $module . '.' . $plugin_file_name . '.yml'
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,74 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\ProfileGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\ProfileGenerator;
use Drupal\Console\Test\DataProvider\ProfileDataProviderTrait;
/**
* Class ProfileGeneratorTest
* @package Drupal\Console\Test\Generator
*/
class ProfileGeneratorTest extends GeneratorTest
{
use ProfileDataProviderTrait;
/**
* Profile generator test.
*
* @param $profile
* @param $machine_name
* @param $profile_path
* @param $description
* @param $core
* @param $dependencies
* @param $distribution
*
* @dataProvider commandData
*/
public function testGenerateProfile(
$profile,
$machine_name,
$profile_path,
$description,
$core,
$dependencies,
$themes,
$distribution
) {
$generator = new ProfileGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$profile,
$machine_name,
$profile_path,
$description,
$core,
$dependencies,
$themes,
$distribution
);
$files = [
$machine_name . '.info.yml',
$machine_name . '.install',
$machine_name . '.profile',
];
foreach ($files as $file) {
$file_path = $profile_path . '/' . $machine_name . '/' . $file;
$this->assertTrue(
file_exists($file_path),
sprintf('%s has been generated', $file_path)
);
}
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\ServiceGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\ServiceGenerator;
use Drupal\Console\Test\DataProvider\ServiceDataProviderTrait;
class ServiceGeneratorTest extends GeneratorTest
{
use ServiceDataProviderTrait;
/**
* Service generator test
*
* @param $module
* @param $name
* @param $class
* @param $interface
* @param $services
* @param $path_service
*
* @dataProvider commandData
*/
public function testGenerateService(
$module,
$name,
$class,
$interface,
$services,
$path_service
) {
$generator = new ServiceGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$module,
$name,
$class,
$interface,
$services,
$path_service
);
$files = [
$generator->getSite()->getModulePath($module).'/'.$module.'.services.yml',
$generator->getSite()->getModulePath($module).'/'.$path_service .'/'.$class.'.php'
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
}
}

View file

@ -0,0 +1,82 @@
<?php
/**
* @file
* Contains Drupal\Console\Test\Generator\ThemeGeneratorTest.
*/
namespace Drupal\Console\Test\Generator;
use Drupal\Console\Generator\ThemeGenerator;
use Drupal\Console\Test\DataProvider\ThemeDataProviderTrait;
class ThemeGeneratorTest extends GeneratorTest
{
use ThemeDataProviderTrait;
/**
* Theme generator test
*
* @param $theme
* @param $machine_name
* @param $theme_path
* @param $description
* @param $core
* @param $package
* @param $global_library
* @param $base_theme
* @param $regions
* @param $breakpoints
*
* @dataProvider commandData
*/
public function testGenerateTheme(
$theme,
$machine_name,
$theme_path,
$description,
$core,
$package,
$global_library,
$base_theme,
$regions,
$breakpoints
) {
$generator = new ThemeGenerator();
$this->getRenderHelper()->setSkeletonDirs($this->getSkeletonDirs());
$this->getRenderHelper()->setTranslator($this->getTranslatorHelper());
$generator->setHelperSet($this->getHelperSet());
$generator->generate(
$theme,
$machine_name,
$theme_path,
$description,
$core,
$package,
$global_library,
$base_theme,
$regions,
$breakpoints
);
$files = [
$theme_path . '/' . $machine_name . '/' . $machine_name . '.info.yml',
$theme_path . '/' . $machine_name . '/' . $machine_name . '.theme'
];
foreach ($files as $file) {
$this->assertTrue(
file_exists($file),
sprintf('%s does not exist', $file)
);
}
if ($breakpoints) {
$this->assertTrue(
file_exists($theme_path . '/' . $machine_name . '.breakpoints.yml'),
sprintf('%s does not exist', $machine_name . '.breakpoints.yml')
);
}
}
}

View file

@ -0,0 +1,55 @@
<?php
namespace Drupal\Console\Test\Helper;
use Drupal\Console\Helper\StringHelper;
class StringHelperTest extends \PHPUnit_Framework_TestCase
{
/* @var $stringHelper */
protected $stringHelper;
protected function setUp()
{
$this->stringHelper = new StringHelper();
}
/**
* @dataProvider getDataNames
*/
public function testCreateMachineName($input, $machine_name)
{
$this->assertEquals($this->stringHelper->createMachineName($input), $machine_name);
}
/**
* @dataProvider getDataCamelCaseNames
*/
public function testCamelCaseToMachineName($camel_case, $machine_name)
{
$this->assertEquals($this->stringHelper->camelCaseToMachineName($camel_case), $machine_name);
}
/**
* Random strings and their equivalent machine-name
*/
public function getDataNames()
{
return [
['Test Space between words', 'test_space_between_words'],
['test$special*characters!', 'test_special_characters'],
['URL', 'url'],
];
}
/**
* Camel-case strings and their equivalent machine-name
*/
public function getDataCamelCaseNames()
{
return [
['camelCase', 'camel_case'],
['greatestFunctionEverWritten', 'greatest_function_ever_written'],
['WakeUp', 'wake_up'],
];
}
}

View file

@ -0,0 +1,3 @@
<?php
$autoloaders = [ getcwd() . '/vendor/autoload.php' ];

View file

@ -0,0 +1,7 @@
<?php
$loader = require __DIR__ . '/vendor/autoload.php';
$loader->setPsr4('Drupal\\Console\\Test\\', __DIR__ . '/Test');
return $loader;

4
vendor/drupal/console/bin/drupal vendored Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env php
<?php
require 'drupal.php';

2
vendor/drupal/console/bin/drupal.bat vendored Normal file
View file

@ -0,0 +1,2 @@
@echo off
php "%~dp0/drupal.php" %*

89
vendor/drupal/console/bin/drupal.php vendored Normal file
View file

@ -0,0 +1,89 @@
<?php
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Input\ArrayInput;
use Drupal\Console\Core\Utils\ConfigurationManager;
use Drupal\Console\Core\Utils\ArgvInputReader;
use Drupal\Console\Core\Utils\DrupalFinder;
use Drupal\Console\Core\Style\DrupalStyle;
use Drupal\Console\Bootstrap\Drupal;
use Drupal\Console\Application;
set_time_limit(0);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$autoloaders = [];
if (file_exists(__DIR__ . '/../autoload.local.php')) {
include_once __DIR__ . '/../autoload.local.php';
} else {
$autoloaders = [
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../vendor/autoload.php'
];
}
foreach ($autoloaders as $file) {
if (file_exists($file)) {
$autoloader = $file;
break;
}
}
if (isset($autoloader)) {
$autoload = include_once $autoloader;
} else {
echo ' You must set up the project dependencies using `composer install`' . PHP_EOL;
exit(1);
}
$output = new ConsoleOutput();
$input = new ArrayInput([]);
$io = new DrupalStyle($input, $output);
$argvInputReader = new ArgvInputReader();
$root = $argvInputReader->get('root', getcwd());
$drupalFinder = new DrupalFinder();
if (!$drupalFinder->locateRoot($root)) {
$io->error('DrupalConsole must be executed within a Drupal Site.');
exit(1);
}
chdir($drupalFinder->getDrupalRoot());
$configurationManager = new ConfigurationManager();
$configuration = $configurationManager
->loadConfiguration($drupalFinder->getComposerRoot())
->getConfiguration();
$debug = $argvInputReader->get('debug', false);
if ($configuration && $options = $configuration->get('application.options') ?: []) {
$argvInputReader->setOptionsFromConfiguration($options);
}
$argvInputReader->setOptionsAsArgv();
if ($debug) {
$io->writeln(
sprintf(
'<info>%s</info> version <comment>%s</comment>',
Application::NAME,
Application::VERSION
)
);
}
$drupal = new Drupal($autoload, $drupalFinder, $configurationManager);
$container = $drupal->boot();
if (!$container) {
$io->error('Something was wrong. Drupal can not be bootstrap.');
exit(1);
}
$application = new Application($container);
$application->setDrupal($drupal);
$application->run();

29
vendor/drupal/console/box.json vendored Normal file
View file

@ -0,0 +1,29 @@
{
"alias": "console.phar",
"chmod": "0755",
"directories": [
"config",
"src",
"templates"
],
"files": [
"config.yml",
"services.yml",
"bin/drupal.php",
"vendor/autoload.php"
],
"finder": [
{
"name": "/(\\.php|\\.json|\\.yml|\\.twig)$/",
"exclude": ["Tests","tests", "docs"],
"in": "vendor"
}
],
"compactors": [
"Herrera\\Box\\Compactor\\Php"
],
"compression": "GZ",
"main": "bin/drupal",
"output": "drupal.phar",
"stub": true
}

66
vendor/drupal/console/composer.json vendored Normal file
View file

@ -0,0 +1,66 @@
{
"name": "drupal/console",
"description": "The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.",
"keywords": ["Drupal", "Console", "Development", "Symfony"],
"homepage": "http://drupalconsole.com/",
"type": "library",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "David Flores",
"email": "dmousex@gmail.com",
"homepage": "http://dmouse.net"
},
{
"name": "Jesus Manuel Olivas",
"email": "jesus.olivas@gmail.com",
"homepage": "http://jmolivas.com"
},
{
"name": "Eduardo Garcia",
"email": "enzo@enzolutions.com",
"homepage": "http://enzolutions.com/"
},
{
"name": "Omar Aguirre",
"email": "omersguchigu@gmail.com"
},
{
"name": "Drupal Console Contributors",
"homepage": "https://github.com/hechoendrupal/drupal-console/graphs/contributors"
}
],
"support": {
"issues": "https://github.com/hechoendrupal/drupal-console/issues",
"forum": "https://gitter.im/hechoendrupal/DrupalConsole",
"docs": "https://docs.drupalconsole.com/"
},
"require": {
"php": "^5.5.9 || ^7.0",
"alchemy/zippy": "0.4.3",
"composer/installers": "~1.0",
"doctrine/annotations": "^1.2",
"doctrine/collections": "^1.3",
"drupal/console-core": "1.8.0",
"drupal/console-extend-plugin": "~0",
"guzzlehttp/guzzle": "~6.1",
"psy/psysh": "0.6.* || ~0.8",
"symfony/css-selector": "~2.8|~3.0",
"symfony/dom-crawler": "~2.8|~3.0",
"symfony/http-foundation": "~2.8|~3.0"
},
"suggest": {
"symfony/thanks": "Thank your favorite PHP projects on Github using the CLI!",
"vlucas/phpdotenv": "Loads environment variables from .env to getenv(), $_ENV and $_SERVER automagically."
},
"bin": ["bin/drupal"],
"config": {
"bin-dir": "bin/",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {"Drupal\\Console\\": "src"}
}
}

Some files were not shown because too many files have changed in this diff Show more