Skip to content

Commit

Permalink
VSCode support, code coverage and reports, test debug support
Browse files Browse the repository at this point in the history
* Add VSCode config for launching debugger.
* Now get code coverage with updated PHPUnit.
* Update target PHP version. We had been targeting 5.5 which is way old.
* Added commented out code that is useful for debugging tests.
  • Loading branch information
MIchaelMainer authored Jan 29, 2020
2 parents 2054f86 + 3317614 commit 83701b6
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ language: php

matrix:
include:
- php: 5.6
- php: 7.0
- php: 7.1
- php: 5.6
env: COMPOSER_FLAGS="--prefer-lowest"

before_install:
Expand Down
22 changes: 22 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"port": 9000
},
{
"name": "Launch currently open script",
"type": "php",
"request": "launch",
"program": "${file}",
"cwd": "${fileDirname}",
"port": 9000
}
]
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
}
],
"require": {
"php": "^5.6 || ^7.0",
"php": "^7.1",
"guzzlehttp/guzzle": "^6.2"
},
"require-dev": {
"phpunit/phpunit": "^5.5",
"phpunit/phpunit": "^7.5",
"phpdocumentor/phpdocumentor": "^2.9",
"mikey179/vfsStream": "^1.2"
},
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="coverage/report" charset="UTF-8" yui="true" highlight="true" lowUpperBound="50" highLowerBound="80"/>
<log type="coverage-html" target="coverage/report" lowUpperBound="50" highLowerBound="80"/>
</logging>
</phpunit>
5 changes: 4 additions & 1 deletion tests/Functional/GraphTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ public function __construct()

public function getAuthenticatedClient()
{
if ($this->graphClient == null)
if ($this->graphClient == null)
{
$this->graphClient = new Graph();
$this->graphClient->setAccessToken($this->getAccessToken());
//$this->graphClient->setProxyPort("localhost:8888"); // Need for fiddler.
}
}

Expand All @@ -46,6 +47,8 @@ public function getAccessToken()
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $body);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); // turns off SSL check,
//curl_setopt($ch, CURLOPT_PROXY, "127.0.0.1:8888"); // need for fiddler + auth
curl_setopt($ch, CURLOPT_HTTPHEADER, array($this->contentType, 'Content-Length: ' . strlen($body)));

$result = curl_exec ($ch);
Expand Down
2 changes: 1 addition & 1 deletion tests/Http/GraphCollectionRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function setUp()

public function testHitEndOfCollection()
{
$this->expectException(PHPUnit_Framework_Error::class);
$this->expectException(\PHPUnit\Framework\Error\Error::class);

//First page
$this->collectionRequest->setPageCallInfo();
Expand Down

0 comments on commit 83701b6

Please sign in to comment.