Skip to content

Commit

Permalink
[BUGFIX] Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
o-ba committed Nov 17, 2021
1 parent c560c3b commit a74ef5d
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 56 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.idea/
/.php_cs.cache
/.php-cs-fixer.cache
/.DS_Store
/vendor
/.env
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"@php vendor/bin/phpunit --testsuite Unit"
],
"cs": [
"@php vendor/bin/php-cs-fixer fix --dry-run --diff --diff-format=udiff --config=vendor/typo3/coding-standards/templates/extension_php_cs.dist src/ tests/"
"@php vendor/bin/php-cs-fixer fix --dry-run --diff --config=vendor/typo3/coding-standards/templates/extension_php-cs-fixer.dist.php src/ tests/"
]
}
}
2 changes: 1 addition & 1 deletion src/Command/Extension/UploadExtensionVersionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ protected function getFormDataPart(array $options): FormDataPart
return new FormDataPart([
'description' => (string)$options['comment'],
'gplCompliant' => '1',
'file' => DataPart::fromPath($versionService->getVersionFilePath())
'file' => DataPart::fromPath($versionService->getVersionFilePath()),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Formatter/ConsoleFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected function formatTable(array $content): void
new OutputPart(
[
['Extension Key', 'Title', 'Latest Version', 'Last Updated on', 'Composer Name'],
$extensions
$extensions,
],
OutputPart::OUTPUT_TABLE
)
Expand Down
2 changes: 1 addition & 1 deletion src/HttpClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static function create(RequestConfiguration $requestConfiguration): HttpC
'User-Agent' => 'Tailor - Your TYPO3 Extension Helper',
], $requestConfiguration->getHeaders()),
// REST API does not perform redirects
'max_redirects' => 0
'max_redirects' => 0,
];
if ($requestConfiguration->getQuery() !== []) {
$options['query'] = $requestConfiguration->getQuery();
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Fixtures/EmConf/emconf_invalid.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

return [
'YES' => true
'YES' => true,
];
2 changes: 1 addition & 1 deletion tests/Unit/Fixtures/EmConf/emconf_no_structure.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

$EM_CONF = [
'nothing' => 'YES'
'nothing' => 'YES',
];
2 changes: 1 addition & 1 deletion tests/Unit/Fixtures/EmConf/emconf_no_version.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php

$EM_CONF = [
'nothing' => 'YES'
'nothing' => 'YES',
];
4 changes: 2 additions & 2 deletions tests/Unit/Fixtures/EmConf/emconf_valid.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
'constraints' => [
'depends' => [
'typo3' => '10.0.0-11.99.99',
]
]
],
],
];
4 changes: 2 additions & 2 deletions tests/Unit/Fixtures/EmConf/emconf_valid_string_array_key.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
'constraints' => [
'depends' => [
'typo3' => '10.0.0-11.99.99',
]
]
],
],
];
4 changes: 2 additions & 2 deletions tests/Unit/Fixtures/ExcludeFromPackaging/config_invalid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

return [
'folders' => [
'dummy'
]
'dummy',
],
];
4 changes: 2 additions & 2 deletions tests/Unit/Fixtures/ExcludeFromPackaging/config_valid.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

return [
'directories' => [
'dummy'
'dummy',
],
'files' => [
'dummy',
]
],
];
66 changes: 33 additions & 33 deletions tests/Unit/Formatter/ConsoleFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,19 @@ public function formatReturnsFormattedPartsDataProvider(): \Generator
yield 'No output' => [
[
'some' => [
'dummy' => 'data'
]
'dummy' => 'data',
],
],
[],
[],
ConsoleFormatter::FORMAT_NONE
ConsoleFormatter::FORMAT_NONE,
];
yield 'Simple key/values array' => [
[
'dummy' => 'data',
'noKey',
'notKeyValue' => [
'foo' => 'bar'
'foo' => 'bar',
],
'some_Key' => 'otherData',
],
Expand All @@ -75,7 +75,7 @@ public function formatReturnsFormattedPartsDataProvider(): \Generator
['<info>Some Key</info>: otherData'],
],
[],
ConsoleFormatter::FORMAT_KEY_VALUE
ConsoleFormatter::FORMAT_KEY_VALUE,
];
yield 'Extension details list' => [
[
Expand All @@ -87,12 +87,12 @@ public function formatReturnsFormattedPartsDataProvider(): \Generator
'paypal_url' => '',
'tags' => [
[
'title' => 'sometag'
'title' => 'sometag',
],
[
'title' => 'anothertag'
]
]
'title' => 'anothertag',
],
],
],
'current_version' => [
'title' => 'foobar',
Expand All @@ -101,28 +101,28 @@ public function formatReturnsFormattedPartsDataProvider(): \Generator
'state' => 'stable',
'category' => 'be',
'typo3_versions' => [
9, 10
9, 10,
],
'dependencies' => [
'typo3' => '10.0.0 - 10.99.99',
],
'conflicts' => [
'templavoila' => '*'
'templavoila' => '*',
],
'downloads' => 1234,
'upload_date' => 1606400890,
'review_state' => 0,
'download' => [
'composer' => 'composer req vendor/some_ext',
'zip' => 'https://extensions.typo3.org/extension/download/some_ext/1.0.0/zip',
't3x' => 'https://extensions.typo3.org/extension/download/some_ext/1.0.0/t3x'
't3x' => 'https://extensions.typo3.org/extension/download/some_ext/1.0.0/t3x',
],
'author' => [
'name' => 'John Doe',
'email' => 'some-mail@example.com',
'company' => 'ACME Inc'
]
]
'company' => 'ACME Inc',
],
],
],
[
['<info>Key</info>: some_ext'],
Expand Down Expand Up @@ -156,10 +156,10 @@ public function formatReturnsFormattedPartsDataProvider(): \Generator
[PHP_EOL . 'Author'],
['<info>Name</info>: John Doe'],
['<info>Email</info>: some-mail@example.com'],
['<info>Company</info>: ACME Inc']
['<info>Company</info>: ACME Inc'],
],
[],
ConsoleFormatter::FORMAT_DETAIL
ConsoleFormatter::FORMAT_DETAIL,
];
yield 'Details with empty array' => [
[
Expand All @@ -168,60 +168,60 @@ public function formatReturnsFormattedPartsDataProvider(): \Generator
'version_count' => 2,
'meta' => [
'composer_name' => 'vendor/some_ext',
'tags' => []
'tags' => [],
],
'current_version' => []
'current_version' => [],
],
[
['<info>Key</info>: some_ext'],
['<info>Downloads</info>: 60'],
['<info>Version count</info>: 2'],
[PHP_EOL . 'Meta'],
['<info>Composer name</info>: vendor/some_ext']
['<info>Composer name</info>: vendor/some_ext'],
],
[],
ConsoleFormatter::FORMAT_DETAIL
ConsoleFormatter::FORMAT_DETAIL,
];
yield 'Find extensions result' => [
[
'results' => 2,
'page' => 1,
'per_page' => 2,
'filter' => [
'username' => 'some_user'
'username' => 'some_user',
],
'extensions' => [
[
'key' => 'some_ext',
'meta' => [
'composer_name' => 'vendor/some_ext'
'composer_name' => 'vendor/some_ext',
],
'current_version' => [
'title' => 'foobar',
'number' => '1.0.0',
'upload_date' => 1605785659
]
'upload_date' => 1605785659,
],
],
[
'key' => 'another_ext'
]
]
'key' => 'another_ext',
],
],
],
[
[
['Extension Key', 'Title', 'Latest Version', 'Last Updated on', 'Composer Name'],
[
'another_ext' => ['another_ext', '-', '-', '-', '-'],
'some_ext' => ['some_ext', 'foobar', '1.0.0', '19.11.2020', 'vendor/some_ext']
]
'some_ext' => ['some_ext', 'foobar', '1.0.0', '19.11.2020', 'vendor/some_ext'],
],
],
['Page: 1, Per page: 2, Filter: some_user (Author)']
['Page: 1, Per page: 2, Filter: some_user (Author)'],
],
[
OutputPart::OUTPUT_TABLE,
OutputPart::OUTPUT_WRITE_LINE
OutputPart::OUTPUT_WRITE_LINE,
],
ConsoleFormatter::FORMAT_TABLE
ConsoleFormatter::FORMAT_TABLE,
];
}
}
16 changes: 8 additions & 8 deletions tests/Unit/Validation/VersionValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,35 +38,35 @@ public function isValidTestDataProvider(): \Generator
{
yield 'Wrong format' => [
'v1',
false
false,
];
yield 'Wrong delimiter' => [
'1-0-0',
false
false,
];
yield 'Missing patch version' => [
'1.0',
false
false,
];
yield 'Patch version to high' => [
'1.0.1000',
false
false,
];
yield 'Patch version to low' => [
'1.0.-12',
false
false,
];
yield 'Not numeric' => [
'0.2.0-alpha',
false
false,
];
yield 'Valid version' => [
'1.0.0',
true
true,
];
yield 'Valid version 2' => [
'10.4.999',
true
true,
];
}
}

0 comments on commit a74ef5d

Please sign in to comment.