Skip to content

Commit fa71400

Browse files
authored
Merge pull request #19 from mediact/feature/phpstorm-path-changed
Added compatibility for latest testing suite.
2 parents b132379 + a40b6a2 commit fa71400

File tree

12 files changed

+74
-126
lines changed

12 files changed

+74
-126
lines changed

.env.dev

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PHP_VERSION=7.4
2+
GCLOUD_LOCAL="~/.config/gcloud"
3+
GIT_CONFIG_LOCAL="~/.gitconfig"

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
## 2.2.1 - 2021-03-10
88
### Fixed
9-
- PhpStorm 2020 has changed there config folder to a different path.
9+
- PhpStorm 2020 has changed there config folder to a different path.
10+
11+
### Added
12+
- Compatibility for latest testing suite 2.4.2.
13+
14+
### Changed
15+
- phpunits to test the code. Some old functions were deprecated.

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414
"composer-plugin-api": "^1.0 || ^2.0"
1515
},
1616
"require-dev": {
17-
"phpunit/phpunit": "^7.5",
17+
"mediact/testing-suite": "@stable",
1818
"composer/composer": "^1.3 || ^2.0",
1919
"kint-php/kint": "@stable",
2020
"mediact/coding-standard": "@stable",
21-
"phpro/grumphp": ">=0.19 <1.0",
2221
"phpstan/phpstan": "@stable",
23-
"sensiolabs/security-checker": "@stable",
24-
"mikey179/vfsstream": "^1.6"
22+
"mikey179/vfsstream": "^1.6",
23+
"ext-simplexml": "*"
2524
},
2625
"autoload": {
2726
"psr-4": {
@@ -46,7 +45,9 @@
4645
"/phpstan.neon",
4746
"/phpcs.xml",
4847
"/grumphp.yml",
49-
"/pdepend.xml"
48+
"/pdepend.xml",
49+
"/docker-compose.yml",
50+
"/.env.dev"
5051
]
5152
},
5253
"config": {

docker-compose.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# vim: ai:ts=2:sw=2:et
2+
version: "3.4"
3+
networks: {}
4+
volumes: {}
5+
6+
x-custom:
7+
version: 1.0.0
8+
type: magento-2-module
9+
environment: &env-vars
10+
# Environment settings
11+
- "HOME=${CHOME}"
12+
- COMPOSER_MEMORY_LIMIT
13+
- XDEBUG_CONFIG
14+
- SSH_AUTH_SOCK
15+
16+
services:
17+
console:
18+
image: "eu.gcr.io/mct-deployments/magento-2-console:${PHP_VERSION}"
19+
user: "${UID}:${GID}"
20+
network_mode: bridge
21+
environment: *env-vars
22+
working_dir: "${PWD}"
23+
volumes:
24+
- "${HOME}:${CHOME}"
25+
- "${PWD}:${PWD}"
26+
- "${GCLOUD_LOCAL}:/config/mygcloud"
27+
- "${GIT_CONFIG_LOCAL}:/etc/gitconfig:ro"
28+
- "${SSH_AUTH_SOCK}:${SSH_AUTH_SOCK}"
29+
- /etc/group:/etc/group:ro
30+
- /etc/passwd:/etc/passwd:ro
31+
- /etc/shadow:/etc/shadow:ro

files/fileTemplates/M2-Layout-XML.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0"?>
22
#parse("M2-XML-File-Header")
3-
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
3+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
44
<body>
55
#[[$END$]]#
66
</body>

grumphp.yml

Lines changed: 3 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,11 @@
1+
imports:
2+
- resource: 'vendor/mediact/testing-suite/config/default/grumphp.yml'
13
parameters:
2-
# Default settings for testing suite tasks
3-
composer.strict: false
4-
5-
jsonlint.detect_key_conflicts: true
6-
7-
xmllint.load_from_net: true
8-
xmllint.x_include: true
9-
xmllint.dtd_validation: true
10-
xmllint.scheme_validation: true
11-
xmllint.triggered_by: [xml]
124
xmllint.ignore_patterns:
135
# Uses an incomplete definition, which conflicts when <exclude-pattern>
146
# is defined.
157
- /^phpcs.xml$/
168
- /^phpmd.xml$/
179
- /^phpunit.xml$/
1810
- /^pdepend.xml$/
19-
- /^files/
20-
21-
yamllint.parse_constant: true
22-
23-
phpcs.standard: ./phpcs.xml
24-
phpcs.triggered_by: [php]
25-
26-
phpmd.exclude: []
27-
phpmd.ruleset:
28-
- ./phpmd.xml
29-
phpmd.triggered_by: [php]
30-
31-
phpstan.autoload_file: ~
32-
phpstan.configuration: ./phpstan.neon
33-
phpstan.level: 4
34-
phpstan.triggered_by: [php]
35-
36-
phpunit.config_file: ./phpunit.xml
37-
38-
securitychecker.lockfile: ./composer.lock
39-
securitychecker.format: ~
40-
securitychecker.end_point: ~
41-
securitychecker.timeout: ~
42-
securitychecker.run_always: true
43-
44-
grumphp:
45-
46-
ascii:
47-
failed: ~
48-
succeeded: ~
49-
50-
parallel:
51-
enabled: false
52-
53-
# Default tasks for testing suite
54-
tasks:
55-
composer:
56-
strict: '%composer.strict%'
57-
58-
jsonlint:
59-
detect_key_conflicts: '%jsonlint.detect_key_conflicts%'
60-
61-
xmllint:
62-
load_from_net: '%xmllint.load_from_net%'
63-
x_include: '%xmllint.x_include%'
64-
dtd_validation: '%xmllint.dtd_validation%'
65-
scheme_validation: '%xmllint.scheme_validation%'
66-
triggered_by: '%xmllint.triggered_by%'
67-
ignore_patterns: '%xmllint.ignore_patterns%'
68-
69-
yamllint:
70-
parse_constant: '%yamllint.parse_constant%'
71-
72-
phpcs:
73-
standard: '%phpcs.standard%'
74-
triggered_by: '%phpcs.triggered_by%'
75-
76-
phpmd:
77-
exclude: '%phpmd.exclude%'
78-
ruleset: '%phpmd.ruleset%'
79-
triggered_by: '%phpmd.triggered_by%'
80-
81-
phpstan:
82-
autoload_file: '%phpstan.autoload_file%'
83-
configuration: '%phpstan.configuration%'
84-
level: '%phpstan.level%'
85-
triggered_by: '%phpstan.triggered_by%'
86-
87-
phpunit:
88-
config_file: '%phpunit.config_file%'
89-
90-
securitychecker:
91-
lockfile: '%securitychecker.lockfile%'
92-
format: '%securitychecker.format%'
93-
end_point: '%securitychecker.end_point%'
94-
timeout: '%securitychecker.timeout%'
95-
run_always: '%securitychecker.run_always%'
96-
11+
- /^files/

phpunit.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1+
<?xml version="1.0"?>
12
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
3-
bootstrap="vendor/autoload.php"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="vendor/autoload.php"
44
cacheResult="false">
5+
<coverage processUncoveredFiles="true">
6+
<include>
7+
<directory suffix=".php">src</directory>
8+
</include>
9+
<exclude>
10+
<file>src/Plugin.php</file>
11+
</exclude>
12+
</coverage>
513
<testsuites>
614
<testsuite name="default">
715
<directory>tests</directory>
816
</testsuite>
917
</testsuites>
10-
<filter>
11-
<whitelist processUncoveredFilesFromWhitelist="true">
12-
<directory suffix=".php">src</directory>
13-
<exclude>
14-
<file>src/Plugin.php</file>
15-
</exclude>
16-
</whitelist>
17-
</filter>
1818
</phpunit>

src/InstallerPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function getPhpStormDefaultPath(): string
140140

141141
if (! empty($phpStormDefaultPaths)) {
142142
$phpStormDefaultPath = reset($phpStormDefaultPaths);
143-
} elseif(! empty($phpStormNewDefaultPaths)) {
143+
} elseif (! empty($phpStormNewDefaultPaths)) {
144144
$phpStormDefaultPath = reset($phpStormNewDefaultPaths);
145145
}
146146

src/Plugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function getPhpStormDefaultPath(): string
146146

147147
if (! empty($phpStormDefaultPaths)) {
148148
$phpStormDefaultPath = reset($phpStormDefaultPaths);
149-
} elseif(! empty($phpStormNewDefaultPaths)) {
149+
} elseif (! empty($phpStormNewDefaultPaths)) {
150150
$phpStormDefaultPath = reset($phpStormNewDefaultPaths);
151151
}
152152

tests/FilesystemTest.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use org\bovigo\vfs\vfsStreamDirectory;
1212
use PHPUnit\Framework\TestCase;
1313
use Mediact\CodingStandard\PhpStorm\Filesystem;
14+
use RuntimeException;
1415

1516
/**
1617
* @coversDefaultClass \Mediact\CodingStandard\PhpStorm\Filesystem
@@ -67,12 +68,11 @@ public function testRead(
6768
/**
6869
* @return void
6970
*
70-
* @expectedException \RuntimeException
71-
*
7271
* @covers ::read
7372
*/
7473
public function testReadExceptionReadable()
7574
{
75+
$this->expectException(RuntimeException::class);
7676
$filesystem = new Filesystem($this->vfs->url());
7777

7878
$this->createFile('foo.txt', 'foo', 0000);
@@ -82,12 +82,11 @@ public function testReadExceptionReadable()
8282
/**
8383
* @return void
8484
*
85-
* @expectedException \RuntimeException
86-
*
8785
* @covers ::read
8886
*/
8987
public function testReadExceptionDir()
9088
{
89+
$this->expectException(RuntimeException::class);
9190
$filesystem = new Filesystem($this->vfs->url());
9291

9392
$filesystem->read('');
@@ -137,12 +136,11 @@ public function testPut(
137136
/**
138137
* @return void
139138
*
140-
* @expectedException \RuntimeException
141-
*
142139
* @covers ::put
143140
*/
144141
public function testPutExceptionWritableFile()
145142
{
143+
$this->expectException(RuntimeException::class);
146144
$filesystem = new Filesystem($this->vfs->url());
147145

148146
$this->createFile('path/to/foo.txt', 'foo', 0000);
@@ -152,12 +150,11 @@ public function testPutExceptionWritableFile()
152150
/**
153151
* @return void
154152
*
155-
* @expectedException \RuntimeException
156-
*
157153
* @covers ::put
158154
*/
159155
public function testPutExceptionWritableDirectory()
160156
{
157+
$this->expectException(RuntimeException::class);
161158
$filesystem = new Filesystem($this->vfs->url());
162159

163160
$this->createDir('path/to', 0000);
@@ -194,12 +191,11 @@ public function testCreateDir()
194191
/**
195192
* @return void
196193
*
197-
* @expectedException \RuntimeException
198-
*
199194
* @covers ::createDir
200195
*/
201196
public function testCreateDirExceptionFile()
202197
{
198+
$this->expectException(RuntimeException::class);
203199
$filesystem = new Filesystem($this->vfs->url());
204200

205201
$this->createFile('foo/bar', 'foo');
@@ -209,12 +205,11 @@ public function testCreateDirExceptionFile()
209205
/**
210206
* @return void
211207
*
212-
* @expectedException \RuntimeException
213-
*
214208
* @covers ::createDir
215209
*/
216210
public function testCreateDirExceptionWritable()
217211
{
212+
$this->expectException(RuntimeException::class);
218213
$filesystem = new Filesystem($this->vfs->url());
219214

220215
$this->createDir('foo', 0000);
@@ -249,12 +244,11 @@ public function testListFiles(
249244
/**
250245
* @return void
251246
*
252-
* @expectedException \RuntimeException
253-
*
254247
* @covers ::listFiles
255248
*/
256249
public function testListFilesException()
257250
{
251+
$this->expectException(RuntimeException::class);
258252
$filesystem = new Filesystem($this->vfs->url());
259253

260254
$filesystem->listFiles('foo/bar');

tests/InstallerPluginTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ class InstallerPluginTest extends TestCase
3232
*/
3333
public function testGetSubscribedEvents()
3434
{
35-
$this->assertInternalType(
36-
'array',
35+
$this->assertIsArray(
3736
InstallerPlugin::getSubscribedEvents()
3837
);
3938
}

tests/XmlAccessorTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
namespace Mediact\CodingStandard\PhpStorm\Tests;
99

10+
use InvalidArgumentException;
1011
use PHPUnit\Framework\TestCase;
11-
use PHPUnit_Framework_TestCase;
1212
use Mediact\CodingStandard\PhpStorm\XmlAccessor;
1313

1414
/**
@@ -111,12 +111,11 @@ public function testGetDescendant(
111111
*
112112
* @dataProvider getDescendantDataProvider
113113
*
114-
* @expectedException \InvalidArgumentException
115-
*
116114
* @covers ::getDescendant
117115
*/
118116
public function testGetDescendantException()
119117
{
118+
$this->expectException(InvalidArgumentException::class);
120119
$accessor = new XmlAccessor();
121120

122121
$xml = simplexml_load_string('<some_data></some_data>');

0 commit comments

Comments
 (0)