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

Pcp api #9049

Merged
merged 2 commits into from
Sep 15, 2016
Merged

Pcp api #9049

merged 2 commits into from
Sep 15, 2016

Conversation

alar77
Copy link
Contributor

@alar77 alar77 commented Sep 15, 2016

Get, Create, Delete method added
Test included

Get, Create, Delete method added
Test included
@civicrm-builder
Copy link

Can one of the admins verify this patch?

@alar77 alar77 mentioned this pull request Sep 15, 2016
*/
function civicrm_api3_pcp_create($params) {
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__),
$params, 'Pcp');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggargani Not sure why you need 'Pcp' here and in the 3 relevant function below, you should be able to get away with $params on the one line with the rest, looks like i think your editor is tied to the 80char limit

Copy link
Contributor

@seamuslee001 seamuslee001 Sep 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ggargani I tested locally changing this to ``php

return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(FUNCTION), $params);
``
worked fine when i ran your unit test

Copy link
Contributor Author

@alar77 alar77 Sep 15, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I saw a couple of api and noticed that some of them uses the third parameter other ones not, so I was not sure about the best practise

$this->params = array ('title' => "Pcp title",
// 'status_id' => 0,
'contact_id' => 1, 'page_id' => 1, 'pcp_block_id' => 1);
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed, no need for debugging stuff in core

@seamuslee001
Copy link
Contributor

@ggargani I have just run the civilint from buildkit on your new files they report

FILE: .../buildkit/build/47.demo/sites/all/modules/civicrm/api/v3/Pcp.php

FOUND 7 ERRORS AFFECTING 7 LINES

40 | ERROR | [x] Whitespace found at end of line
44 | ERROR | [x] Whitespace found at end of line
68 | ERROR | [x] Whitespace found at end of line
72 | ERROR | [x] Whitespace found at end of line
83 | ERROR | [x] Whitespace found at end of line
87 | ERROR | [x] Whitespace found at end of line

89 | ERROR | [x] Expected 1 newline at end of file; 0 found

PHPCBF CAN FIX THE 7 MARKED SNIFF VIOLATIONS AUTOMATICALLY

FILE: ....demo/sites/all/modules/civicrm/tests/phpunit/api/v3/PcpTest.php

FOUND 21 ERRORS AFFECTING 16 LINES

45 | ERROR | [x] Whitespace found at end of line
46 | ERROR | [x] Expected 1 space after asterisk; 9 found
54 | ERROR | [x] There must be no space between the "array" keyword
| | and the opening parenthesis
54 | ERROR | [x] The first index in a multi-value array must be on
| | a new line
54 | ERROR | [x] Whitespace found at end of line
56 | ERROR | [x] Array indentation error, expected 6 spaces but
| | found 8
56 | ERROR | [x] Each index in a multi-line array must be on a new
| | line
56 | ERROR | [x] Each index in a multi-line array must be on a new
| | line
74 | ERROR | [x] Whitespace found at end of line
88 | ERROR | [x] Whitespace found at end of line
99 | ERROR | [x] Whitespace found at end of line
100 | ERROR | [x] There must be no space between the "array" keyword
| | and the opening parenthesis
102 | ERROR | [x] Whitespace found at end of line
103 | ERROR | [x] There must be no space between the "array" keyword
| | and the opening parenthesis
104 | ERROR | [x] Whitespace found at end of line
105 | ERROR | [x] There must be no space between the "array" keyword
| | and the opening parenthesis
119 | ERROR | [x] There must be no space between the "array" keyword
| | and the opening parenthesis
121 | ERROR | [x] Whitespace found at end of line
123 | ERROR | [x] There must be no space between the "array" keyword
| | and the opening parenthesis
125 | ERROR | [x] Expected 1 newline at end of file; 0 found
125 | ERROR | [x] The closing brace for the class must have an empty

| | line before it

PHPCBF CAN FIX THE 21 MARKED SNIFF VIOLATIONS AUTOMATICALLY

Can you fix up those style issues

Fixe style issues
@seamuslee001
Copy link
Contributor

@totten @monishdeb Can either of you please ok to test this?

@totten
Copy link
Member

totten commented Sep 15, 2016

jenkins, add to whitelist

@alar77
Copy link
Contributor Author

alar77 commented Sep 15, 2016

@seamuslee001 Wow, you were superfast :) I was still getting used with the release process (and overlooked the autoformatting from eclipse).
I was running civilint while you were commenting, sorry for your time waste.

vagrant@civi:~/civi47$ civilint api/v3/Pcp.php tests/phpunit/api/v3/PcpTest.php
===========================[ Identify Files ]===========================
PHP Files:

  • api/v3/Pcp.php
  • tests/phpunit/api/v3/PcpTest.php
    ===============================[ php -l ]===============================
    ===============================[ phpcs ]===============================

Also

vagrant@civi:~/civi47/tools$ php ./scripts/phpunit --color=always api_v3_PcpTest
PHPUnit 4.8.21 by Sebastian Bergmann and contributors.

.
Installing d7masterte_xl07w database
...

Time: 18.47 seconds, Memory: 40.00Mb

OK (4 tests, 28 assertions)

@seamuslee001
Copy link
Contributor

nice 👍 We'll let the full civisuite run but i think this is pretty good :-)

@seamuslee001
Copy link
Contributor

@eileenmcnaughton @totten @monishdeb Test failure is unrelated think we can merge this

@eileenmcnaughton
Copy link
Contributor

Wow huge effort guys - so many people have started on this api but somehow never completed it but finally you got it all the way!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants