Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use the latest cakephp-pta #49

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ jira-rest-client.log
.phpunit.result.cache
tests/test_app/config/.env
composer.lock

# Visual Studio Code
.vscode
15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Load the helper in your `src/View/AppView.php's initialize()` method:
}
```

This plugin makes use of [josegonzalez/dotenv](https://github.com/josegonzalez/php-dotenv). If you're using his extension, than put the below in your `config/.env` file:
This plugin makes use of [symfony/dotenv](https://github.com/symfony/dotenv). If you're using his extension, than put the below in your `config/.env` file:
```bash
##### Jira Settings. (if the JIRA plugin is active.)
export JIRA_SCHEMA=""
Expand Down Expand Up @@ -141,18 +141,18 @@ I have also added the ability to send Issues to your Jira server.
The 2 default/preconfigured Issues are Bugs and Feature Requests, but you can configure your own as well.

To create your own Issue setup, see these as examples:
- [`Fr3nch\Jira\Controller\TestsController`](blob/master/src/Controller/TestsController.php)
- [`Fr3nch\Jira\Form\TestForm`](blob/master/src/Form/TestForm.php) <-- How you define another Issue type. see the `__construct()` method.
- [`templates/Tests/add.php`](blob/master/templates/Tests/add.php)
- [`templates/Tests/thankyou.php`](blob/master/templates/Tests/thankyou.php)
- [`Fr3nch\Jira\Controller\TestsController`](src/Controller/TestsController.php)
- [`Fr3nch\Jira\Form\TestForm`](src/Form/TestForm.php) <-- How you define another Issue type. see the `__construct()` method.
- [`templates/Tests/add.php`](templates/Tests/add.php)
- [`templates/Tests/thankyou.php`](templates/Tests/thankyou.php)

In my particular instance, I have the links as part of a dropdown menu in my apps' header. My apps use the AdmilLte/bootstrap template/frontend, so if you want, you can include the element existing here like so:
```php
<?php if (Plugin::isLoaded('Fr3nch13/Jira')) : ?>
<?= $this->element('Fr3nch13/Jira.nav-links') ?>
<?php endif; //Plugin::isLoaded('Fr3nch13/Jira') ?>
```
In case you want to see how I'm creating the link to the pages, see the [`templates/element/nav-links.php`](blob/master/templates/element/nav-links.php) file.
In case you want to see how I'm creating the link to the pages, see the [`templates/element/nav-links.php`](templates/element/nav-links.php) file.

If you want to overwrite the plugin templates, do so like you're supposed according to the [CakePHP Documentation](https://book.cakephp.org/4/en/plugins.html#overriding-plugin-templates-from-inside-your-application).

Expand All @@ -174,6 +174,3 @@ Rules are simple:
- 1 feature per PR

We would be happy to merge your feature then.

## Notes
- I've inlcuded the composer.lock file, and if you're forking/pull requesting, you should use it/update it as well. This way our environment is as close as possible. This helps in debugging/replicating an issue.
10 changes: 7 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "~7.4|~8.0",
"php": ">=7.4",
"cakephp/cakephp": "~4.4",
"lesstif/php-jira-rest-client": "~3.1.1"
"lesstif/php-jira-rest-client": "~3.1|~4.1"
},
"require-dev": {
"fr3nch13/cakephp-pta": "~2.4",
"phpunit/phpunit": "^9.6"
"phpunit/phpunit": "^9.6",
"symfony/dotenv": "~5.0||~6.0"
},
"suggest": {
"symfony/dotenv": "If you want to load your jira settings from a .env file."
},
"autoload": {
"psr-4": {
Expand Down
4 changes: 2 additions & 2 deletions config/requirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
/*
* You can remove this if you are confident that your PHP version is sufficient.
*/
if (version_compare(PHP_VERSION, '7.2.0') < 0) {
trigger_error('Your PHP version must be equal or higher than 7.2.0 to use VM Central.' . PHP_EOL, E_USER_ERROR);
if (version_compare(PHP_VERSION, '7.4.0') < 0) {
trigger_error('Your PHP version must be equal or higher than 7.2.0 to use this plugin.' . PHP_EOL, E_USER_ERROR);
}
4 changes: 3 additions & 1 deletion src/Lib/JiraProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@
$issueField->setDescription($data['description']);
}
if (isset($data['priority'])) {
$issueField->setPriorityName($data['priority']);

Check failure on line 583 in src/Lib/JiraProject.php

View workflow job for this annotation

GitHub Actions / Static Analysis - PHP 8.1

Call to an undefined method JiraRestApi\Issue\IssueField::setPriorityName().

Check failure on line 583 in src/Lib/JiraProject.php

View workflow job for this annotation

GitHub Actions / Static Analysis - PHP 8.2

Call to an undefined method JiraRestApi\Issue\IssueField::setPriorityName().

Check failure on line 583 in src/Lib/JiraProject.php

View workflow job for this annotation

GitHub Actions / Static Analysis - PHP 8.0

Call to an undefined method JiraRestApi\Issue\IssueField::setPriorityName().
}
if (isset($data['assignee'])) {
$issueField->setAssigneeName($data['assignee']);
Expand Down Expand Up @@ -650,6 +650,7 @@
*/
public function extractJiraError(string $msg): string
{
/*
if (strpos($msg, '{') !== false) {
$msgArray = str_split($msg);
// extract the json message.
Expand Down Expand Up @@ -682,7 +683,8 @@
}
}
}
*/

return $msg;
return str_replace("\n", " ", $msg);

Check failure on line 688 in src/Lib/JiraProject.php

View workflow job for this annotation

GitHub Actions / Coding Standard

Use single instead of double quotes for simple strings.
}
}
7 changes: 7 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
declare(strict_types=1);

use Cake\Core\Configure;

Check failure on line 4 in tests/bootstrap.php

View workflow job for this annotation

GitHub Actions / Coding Standard

Expected 1 line after last use statement, found 0.
/**
* Test suite bootstrap.
*
Expand All @@ -15,6 +16,12 @@
putenv('JIRA_API_KEY=testapikey');
putenv('JIRA_PROJECT_KEY=TEST');


Check failure on line 19 in tests/bootstrap.php

View workflow job for this annotation

GitHub Actions / Coding Standard

Found more than a single empty line between content

Check failure on line 20 in tests/bootstrap.php

View workflow job for this annotation

GitHub Actions / Coding Standard

Found more than a single empty line between content
Configure::write('Tests.Plugins', [
'Fr3nch13/Jira',
]);

////// Ensure we can setup an environment for the Test Application instance.
$root = dirname(__DIR__);
chdir($root);
Expand Down
38 changes: 0 additions & 38 deletions tests/test_app/config/.env.default

This file was deleted.

Loading
Loading