Skip to content

Commit 461985a

Browse files
committed
Fixed PHP 8 deprecation issue and updated version release number to 1.4.2
1 parent 122c92f commit 461985a

File tree

10 files changed

+257
-36
lines changed

10 files changed

+257
-36
lines changed

composer.lock

Lines changed: 158 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs-md/DeveloperGuide.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,10 @@ methods with 'Curl' in their name that belong to the PhpCapExceptionTest class:
235235

236236
##### Code Coverage
237237
If XDebug has been installed (and PHP is configured to use it), code coverage for the automated tests can
238-
be calculated by running the following command in the root directory of PHPCap:
238+
be calculated by running the following commands in the root directory of PHPCap:
239239

240+
XDEBUG_MODE=coverage
241+
export XDEBUG_MODE
240242
./vendor/bin/phpunit --coverage-html tests/coverage
241243

242244
To see the results, open the file **tests/coverage/index.html** with a web browser. The .gitignore file is set to

docs/DeveloperGuide.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,10 @@ <h5>Running Selected Tests</h5>
273273
<div class="description"><pre><code>./vendor/bin/phpunit tests/unit/PhpCapExceptionTest.php --filter 'Curl'</code></pre></div>
274274
<h5>Code Coverage</h5>
275275
<p>If XDebug has been installed (and PHP is configured to use it), code coverage for the automated tests can
276-
be calculated by running the following command in the root directory of PHPCap:</p>
277-
<div class="description"><pre><code>./vendor/bin/phpunit --coverage-html tests/coverage</code></pre></div>
276+
be calculated by running the following commands in the root directory of PHPCap:</p>
277+
<div class="description"><pre><code>XDEBUG_MODE=coverage
278+
export XDEBUG_MODE
279+
./vendor/bin/phpunit --coverage-html tests/coverage</code></pre></div>
278280
<p>To see the results, open the file <strong>tests/coverage/index.html</strong> with a web browser. The .gitignore file is set to
279281
ignore the tests/coverage directory.</p>
280282
<p>Note that when writing code, it is sometimes necessary to use the <strong>@codeCoverageIgnore</strong> annotation

docs/api/classes/IU-PHPCap-RedCapProject.html

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,13 @@ <h3 id="toc">
392392
</dt>
393393
<dd>Gets the API token for the project.</dd>
394394

395+
<dt class="phpdocumentor-table-of-contents__entry -method -public">
396+
<a href="classes/IU-PHPCap-RedCapProject.html#method_getApiUrl">getApiUrl()</a>
397+
<span>
398+
&nbsp;: string </span>
399+
</dt>
400+
<dd>Gets the REDCap API URL specified to create the object.</dd>
401+
395402
<dt class="phpdocumentor-table-of-contents__entry -method -public">
396403
<a href="classes/IU-PHPCap-RedCapProject.html#method_getConnection">getConnection()</a>
397404
<span>
@@ -3394,7 +3401,7 @@ <h4 class="phpdocumentor-element__name" id="method_getApiToken">
33943401
<aside class="phpdocumentor-element-found-in">
33953402
<abbr class="phpdocumentor-element-found-in__file" title="src/RedCapProject.php"><a href="files/src-redcapproject.html"><abbr title="src/RedCapProject.php">RedCapProject.php</abbr></a></abbr>
33963403
:
3397-
<span class="phpdocumentor-element-found-in__line">2655</span>
3404+
<span class="phpdocumentor-element-found-in__line">2665</span>
33983405

33993406
</aside>
34003407

@@ -3415,6 +3422,41 @@ <h5 class="phpdocumentor-return-value__heading">Return values</h5>
34153422
</section>
34163423

34173424

3425+
</article>
3426+
<article
3427+
class="phpdocumentor-element
3428+
-method
3429+
-public
3430+
"
3431+
>
3432+
<h4 class="phpdocumentor-element__name" id="method_getApiUrl">
3433+
getApiUrl()
3434+
<a href="classes/IU-PHPCap-RedCapProject.html#method_getApiUrl" class="headerlink"><i class="fas fa-link"></i></a>
3435+
</h4>
3436+
<aside class="phpdocumentor-element-found-in">
3437+
<abbr class="phpdocumentor-element-found-in__file" title="src/RedCapProject.php"><a href="files/src-redcapproject.html"><abbr title="src/RedCapProject.php">RedCapProject.php</abbr></a></abbr>
3438+
:
3439+
<span class="phpdocumentor-element-found-in__line">2655</span>
3440+
3441+
</aside>
3442+
3443+
<p class="phpdocumentor-summary">Gets the REDCap API URL specified to create the object.</p>
3444+
3445+
<code class="phpdocumentor-code phpdocumentor-signature ">
3446+
<span class="phpdocumentor-signature__visibility">public</span>
3447+
<span class="phpdocumentor-signature__name">getApiUrl</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">string</span></code>
3448+
3449+
3450+
3451+
3452+
3453+
<h5 class="phpdocumentor-return-value__heading">Return values</h5>
3454+
<span class="phpdocumentor-signature__response_type">string</span>
3455+
&mdash;
3456+
<section class="phpdocumentor-description"><p>the REDCap API URL for the project.</p>
3457+
</section>
3458+
3459+
34183460
</article>
34193461
<article
34203462
class="phpdocumentor-element
@@ -3429,7 +3471,7 @@ <h4 class="phpdocumentor-element__name" id="method_getConnection">
34293471
<aside class="phpdocumentor-element-found-in">
34303472
<abbr class="phpdocumentor-element-found-in__file" title="src/RedCapProject.php"><a href="files/src-redcapproject.html"><abbr title="src/RedCapProject.php">RedCapProject.php</abbr></a></abbr>
34313473
:
3432-
<span class="phpdocumentor-element-found-in__line">2669</span>
3474+
<span class="phpdocumentor-element-found-in__line">2679</span>
34333475

34343476
</aside>
34353477

@@ -3468,7 +3510,7 @@ <h4 class="phpdocumentor-element__name" id="method_getErrorHandler">
34683510
<aside class="phpdocumentor-element-found-in">
34693511
<abbr class="phpdocumentor-element-found-in__file" title="src/RedCapProject.php"><a href="files/src-redcapproject.html"><abbr title="src/RedCapProject.php">RedCapProject.php</abbr></a></abbr>
34703512
:
3471-
<span class="phpdocumentor-element-found-in__line">2690</span>
3513+
<span class="phpdocumentor-element-found-in__line">2700</span>
34723514

34733515
</aside>
34743516

@@ -4927,7 +4969,7 @@ <h4 class="phpdocumentor-element__name" id="method_setConnection">
49274969
<aside class="phpdocumentor-element-found-in">
49284970
<abbr class="phpdocumentor-element-found-in__file" title="src/RedCapProject.php"><a href="files/src-redcapproject.html"><abbr title="src/RedCapProject.php">RedCapProject.php</abbr></a></abbr>
49294971
:
4930-
<span class="phpdocumentor-element-found-in__line">2680</span>
4972+
<span class="phpdocumentor-element-found-in__line">2690</span>
49314973

49324974
</aside>
49334975

@@ -4973,7 +5015,7 @@ <h4 class="phpdocumentor-element__name" id="method_setErrorHandler">
49735015
<aside class="phpdocumentor-element-found-in">
49745016
<abbr class="phpdocumentor-element-found-in__file" title="src/RedCapProject.php"><a href="files/src-redcapproject.html"><abbr title="src/RedCapProject.php">RedCapProject.php</abbr></a></abbr>
49755017
:
4976-
<span class="phpdocumentor-element-found-in__line">2700</span>
5018+
<span class="phpdocumentor-element-found-in__line">2710</span>
49775019

49785020
</aside>
49795021

docs/api/classes/IU-PHPCap-Version.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ <h3 id="toc">
134134
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
135135
<a href="classes/IU-PHPCap-Version.html#constant_RELEASE_NUMBER">RELEASE_NUMBER</a>
136136
<span>
137-
&nbsp;= &quot;1.4.0&quot; </span>
137+
&nbsp;= &quot;1.4.2&quot; </span>
138138
</dt>
139139
<dd></dd>
140140

@@ -166,7 +166,7 @@ <h4 class="phpdocumentor-element__name" id="constant_RELEASE_NUMBER">
166166
<span class="phpdocumentor-signature__visibility">public</span>
167167
<span class="phpdocumentor-signature__type">mixed</span>
168168
<span class="phpdocumentor-signature__name">RELEASE_NUMBER</span>
169-
= <span class="phpdocumentor-signature__default-value">&quot;1.4.0&quot;</span>
169+
= <span class="phpdocumentor-signature__default-value">&quot;1.4.2&quot;</span>
170170
</code>
171171

172172

docs/api/js/searchIndex.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,11 @@ Search.appendIndex(
645645
"name": "getRecordIdFieldName",
646646
"summary": "Gets\u0020the\u0020record\u0020ID\u0020field\u0020name\u0020for\u0020the\u0020project.",
647647
"url": "classes/IU-PHPCap-RedCapProject.html#method_getRecordIdFieldName"
648+
}, {
649+
"fqsen": "\\IU\\PHPCap\\RedCapProject\u003A\u003AgetApiUrl\u0028\u0029",
650+
"name": "getApiUrl",
651+
"summary": "Gets\u0020the\u0020REDCap\u0020API\u0020URL\u0020specified\u0020to\u0020create\u0020the\u0020object.",
652+
"url": "classes/IU-PHPCap-RedCapProject.html#method_getApiUrl"
648653
}, {
649654
"fqsen": "\\IU\\PHPCap\\RedCapProject\u003A\u003AgetApiToken\u0028\u0029",
650655
"name": "getApiToken",

src/RedCapProject.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function __construct(
8080
if (isset($connection)) {
8181
$this->connection = $this->processConnectionArgument($connection);
8282
} else {
83-
$this->apiUrl = $this->processApiUrlArgument($apiUrl);
83+
$apiUrl = $this->processApiUrlArgument($apiUrl);
8484
$sslVerify = $this->processSslVerifyArgument($sslVerify);
8585
$caCertificateFile = $this->processCaCertificateFileArgument($caCertificateFile);
8686

@@ -2647,6 +2647,16 @@ public function getRecordIdFieldName()
26472647
return $recordIdFieldName;
26482648
}
26492649

2650+
/**
2651+
* Gets the REDCap API URL specified to create the object.
2652+
*
2653+
* @return string the REDCap API URL for the project.
2654+
*/
2655+
public function getApiUrl()
2656+
{
2657+
return $this->connection->getUrl();
2658+
}
2659+
26502660
/**
26512661
* Gets the API token for the project.
26522662
*

src/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ class Version
1414
# This release number should be updated each time a release is made.
1515
# This value will be logged to indicate which version of the
1616
# software is being used.
17-
const RELEASE_NUMBER = "1.4.1";
17+
const RELEASE_NUMBER = "1.4.2";
1818
}

tests/integration/RecordsTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1712,6 +1712,20 @@ public function testExportRecordsApWithNonStringDateRange()
17121712
$this->assertTrue($exceptionCaught, 'Exception caught check');
17131713
}
17141714

1715+
public function testExportRecordsApWithInvalidFormatDateRange()
1716+
{
1717+
$exceptionCaught = false;
1718+
try {
1719+
$result = self::$basicDemographyProject->exportRecordsAp(['dateRangeBegin' => '12/01/2022']);
1720+
} catch (\Exception $exception) {
1721+
$exceptionCaught = true;
1722+
$expectedCode = ErrorHandlerInterface::INVALID_ARGUMENT;
1723+
$this->assertEquals($expectedCode, $exception->getCode(), 'Exception code check');
1724+
}
1725+
1726+
$this->assertTrue($exceptionCaught, 'Exception caught check');
1727+
}
1728+
17151729
public function testExportRecordsWithCsvDelimiter()
17161730
{
17171731
#export records with default delimiter (comma)

tests/unit/RedCapProjectTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ public function setUp(): void
3333
$this->connection
3434
);
3535
}
36+
37+
public function testCreateProject()
38+
{
39+
$project = new RedCapProject(
40+
$this->apiUrl,
41+
$this->apiToken,
42+
);
43+
44+
$this->assertEquals($this->apiUrl, $project->getApiUrl(), 'API URL check');
45+
46+
$this->assertEquals($this->apiToken, $project->getApiToken(), 'API token check');
47+
}
3648

3749

3850
public function testCreateProjectWithNullApiUrl()

0 commit comments

Comments
 (0)