Skip to content

Commit

Permalink
Fixed PHP 8 deprecation issue and updated version release number to 1…
Browse files Browse the repository at this point in the history
….4.2
  • Loading branch information
mullen2 committed Oct 16, 2023
1 parent 122c92f commit 461985a
Show file tree
Hide file tree
Showing 10 changed files with 257 additions and 36 deletions.
182 changes: 158 additions & 24 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion docs-md/DeveloperGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ methods with 'Curl' in their name that belong to the PhpCapExceptionTest class:

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

XDEBUG_MODE=coverage
export XDEBUG_MODE
./vendor/bin/phpunit --coverage-html tests/coverage

To see the results, open the file **tests/coverage/index.html** with a web browser. The .gitignore file is set to
Expand Down
6 changes: 4 additions & 2 deletions docs/DeveloperGuide.html
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,10 @@ <h5>Running Selected Tests</h5>
<div class="description"><pre><code>./vendor/bin/phpunit tests/unit/PhpCapExceptionTest.php --filter 'Curl'</code></pre></div>
<h5>Code Coverage</h5>
<p>If XDebug has been installed (and PHP is configured to use it), code coverage for the automated tests can
be calculated by running the following command in the root directory of PHPCap:</p>
<div class="description"><pre><code>./vendor/bin/phpunit --coverage-html tests/coverage</code></pre></div>
be calculated by running the following commands in the root directory of PHPCap:</p>
<div class="description"><pre><code>XDEBUG_MODE=coverage
export XDEBUG_MODE
./vendor/bin/phpunit --coverage-html tests/coverage</code></pre></div>
<p>To see the results, open the file <strong>tests/coverage/index.html</strong> with a web browser. The .gitignore file is set to
ignore the tests/coverage directory.</p>
<p>Note that when writing code, it is sometimes necessary to use the <strong>@codeCoverageIgnore</strong> annotation
Expand Down
52 changes: 47 additions & 5 deletions docs/api/classes/IU-PHPCap-RedCapProject.html
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,13 @@ <h3 id="toc">
</dt>
<dd>Gets the API token for the project.</dd>

<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/IU-PHPCap-RedCapProject.html#method_getApiUrl">getApiUrl()</a>
<span>
&nbsp;: string </span>
</dt>
<dd>Gets the REDCap API URL specified to create the object.</dd>

<dt class="phpdocumentor-table-of-contents__entry -method -public">
<a href="classes/IU-PHPCap-RedCapProject.html#method_getConnection">getConnection()</a>
<span>
Expand Down Expand Up @@ -3394,7 +3401,7 @@ <h4 class="phpdocumentor-element__name" id="method_getApiToken">
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">2655</span>
<span class="phpdocumentor-element-found-in__line">2665</span>

</aside>

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


</article>
<article
class="phpdocumentor-element
-method
-public
"
>
<h4 class="phpdocumentor-element__name" id="method_getApiUrl">
getApiUrl()
<a href="classes/IU-PHPCap-RedCapProject.html#method_getApiUrl" class="headerlink"><i class="fas fa-link"></i></a>
</h4>
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">2655</span>

</aside>

<p class="phpdocumentor-summary">Gets the REDCap API URL specified to create the object.</p>

<code class="phpdocumentor-code phpdocumentor-signature ">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__name">getApiUrl</span><span>(</span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">string</span></code>





<h5 class="phpdocumentor-return-value__heading">Return values</h5>
<span class="phpdocumentor-signature__response_type">string</span>
&mdash;
<section class="phpdocumentor-description"><p>the REDCap API URL for the project.</p>
</section>


</article>
<article
class="phpdocumentor-element
Expand All @@ -3429,7 +3471,7 @@ <h4 class="phpdocumentor-element__name" id="method_getConnection">
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">2669</span>
<span class="phpdocumentor-element-found-in__line">2679</span>

</aside>

Expand Down Expand Up @@ -3468,7 +3510,7 @@ <h4 class="phpdocumentor-element__name" id="method_getErrorHandler">
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">2690</span>
<span class="phpdocumentor-element-found-in__line">2700</span>

</aside>

Expand Down Expand Up @@ -4927,7 +4969,7 @@ <h4 class="phpdocumentor-element__name" id="method_setConnection">
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">2680</span>
<span class="phpdocumentor-element-found-in__line">2690</span>

</aside>

Expand Down Expand Up @@ -4973,7 +5015,7 @@ <h4 class="phpdocumentor-element__name" id="method_setErrorHandler">
<aside class="phpdocumentor-element-found-in">
<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>
:
<span class="phpdocumentor-element-found-in__line">2700</span>
<span class="phpdocumentor-element-found-in__line">2710</span>

</aside>

Expand Down
4 changes: 2 additions & 2 deletions docs/api/classes/IU-PHPCap-Version.html
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ <h3 id="toc">
<dt class="phpdocumentor-table-of-contents__entry -constant -public">
<a href="classes/IU-PHPCap-Version.html#constant_RELEASE_NUMBER">RELEASE_NUMBER</a>
<span>
&nbsp;= &quot;1.4.0&quot; </span>
&nbsp;= &quot;1.4.2&quot; </span>
</dt>
<dd></dd>

Expand Down Expand Up @@ -166,7 +166,7 @@ <h4 class="phpdocumentor-element__name" id="constant_RELEASE_NUMBER">
<span class="phpdocumentor-signature__visibility">public</span>
<span class="phpdocumentor-signature__type">mixed</span>
<span class="phpdocumentor-signature__name">RELEASE_NUMBER</span>
= <span class="phpdocumentor-signature__default-value">&quot;1.4.0&quot;</span>
= <span class="phpdocumentor-signature__default-value">&quot;1.4.2&quot;</span>
</code>


Expand Down
5 changes: 5 additions & 0 deletions docs/api/js/searchIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,11 @@ Search.appendIndex(
"name": "getRecordIdFieldName",
"summary": "Gets\u0020the\u0020record\u0020ID\u0020field\u0020name\u0020for\u0020the\u0020project.",
"url": "classes/IU-PHPCap-RedCapProject.html#method_getRecordIdFieldName"
}, {
"fqsen": "\\IU\\PHPCap\\RedCapProject\u003A\u003AgetApiUrl\u0028\u0029",
"name": "getApiUrl",
"summary": "Gets\u0020the\u0020REDCap\u0020API\u0020URL\u0020specified\u0020to\u0020create\u0020the\u0020object.",
"url": "classes/IU-PHPCap-RedCapProject.html#method_getApiUrl"
}, {
"fqsen": "\\IU\\PHPCap\\RedCapProject\u003A\u003AgetApiToken\u0028\u0029",
"name": "getApiToken",
Expand Down
12 changes: 11 additions & 1 deletion src/RedCapProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function __construct(
if (isset($connection)) {
$this->connection = $this->processConnectionArgument($connection);
} else {
$this->apiUrl = $this->processApiUrlArgument($apiUrl);
$apiUrl = $this->processApiUrlArgument($apiUrl);
$sslVerify = $this->processSslVerifyArgument($sslVerify);
$caCertificateFile = $this->processCaCertificateFileArgument($caCertificateFile);

Expand Down Expand Up @@ -2647,6 +2647,16 @@ public function getRecordIdFieldName()
return $recordIdFieldName;
}

/**
* Gets the REDCap API URL specified to create the object.
*
* @return string the REDCap API URL for the project.
*/
public function getApiUrl()
{
return $this->connection->getUrl();
}

/**
* Gets the API token for the project.
*
Expand Down
2 changes: 1 addition & 1 deletion src/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class Version
# This release number should be updated each time a release is made.
# This value will be logged to indicate which version of the
# software is being used.
const RELEASE_NUMBER = "1.4.1";
const RELEASE_NUMBER = "1.4.2";
}
14 changes: 14 additions & 0 deletions tests/integration/RecordsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,20 @@ public function testExportRecordsApWithNonStringDateRange()
$this->assertTrue($exceptionCaught, 'Exception caught check');
}

public function testExportRecordsApWithInvalidFormatDateRange()
{
$exceptionCaught = false;
try {
$result = self::$basicDemographyProject->exportRecordsAp(['dateRangeBegin' => '12/01/2022']);
} catch (\Exception $exception) {
$exceptionCaught = true;
$expectedCode = ErrorHandlerInterface::INVALID_ARGUMENT;
$this->assertEquals($expectedCode, $exception->getCode(), 'Exception code check');
}

$this->assertTrue($exceptionCaught, 'Exception caught check');
}

public function testExportRecordsWithCsvDelimiter()
{
#export records with default delimiter (comma)
Expand Down
12 changes: 12 additions & 0 deletions tests/unit/RedCapProjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ public function setUp(): void
$this->connection
);
}

public function testCreateProject()
{
$project = new RedCapProject(
$this->apiUrl,
$this->apiToken,
);

$this->assertEquals($this->apiUrl, $project->getApiUrl(), 'API URL check');

$this->assertEquals($this->apiToken, $project->getApiToken(), 'API token check');
}


public function testCreateProjectWithNullApiUrl()
Expand Down

0 comments on commit 461985a

Please sign in to comment.