Skip to content

Commit

Permalink
Upgraded to PHPUnit 9
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasse Lehtinen committed Aug 17, 2021
1 parent 608eb1f commit 2934381
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 70 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/vendor
composer.lock
.idea/
.phpunit.result.cache
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@
}
],
"require": {
"php" : "^7.2",
"php" : "^7.2|^8.0",
"guzzlehttp/guzzle": "~6.0|~7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.4",
"phpro/grumphp": "^0.12.0",
"sensiolabs/security-checker": "^4.1",
"phpunit/phpunit": "^9.0",
"phpro/grumphp": "^1.4",
"squizlabs/php_codesniffer": "^3.1"
},
"autoload": {
Expand Down
25 changes: 17 additions & 8 deletions grumphp.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
# grumphp.yml
parameters:
bin_dir: "./vendor/bin"
git_dir: "."
grumphp:
hooks_dir: ~
hooks_preset: local
stop_on_failure: true
stop_on_failure: false
ignore_unstaged_changes: false
process_timeout: 420
hide_circumvention_tip: false
process_timeout: 60
ascii:
failed: ~
succeeded: ~
parallel:
enabled: true
max_workers: 32
fixer:
enabled: true
fix_by_default: false
environment:
files: []
variables: {}
paths: []
tasks:
composer:
securitychecker:
securitychecker_local:
phpunit:
config_file: ~
phpcs:
standard: PSR2
show_warnings: false
tab_width: 4
triggered_by: [php]
ignore_patterns:
- "vendor*"
- "tests*"
extensions: []
testsuites: []
extensions: []
33 changes: 12 additions & 21 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="MyPackage Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
</phpunit>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" backupGlobals="false" backupStaticAttributes="false" colors="true" verbose="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
<testsuites>
<testsuite name="MyPackage Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
18 changes: 9 additions & 9 deletions tests/BookmarksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public function testAddingBookmark()
$bookmarksAdd = $bookmarks->add('publination', '081024182109-9280632f2866416d97634cdccc66715d');

// Additional checks
$this->assertInternalType('object', $bookmarksAdd);
$this->assertInternalType('object', $bookmarksAdd->bookmark);
$this->assertIsObject($bookmarksAdd);
$this->assertIsObject($bookmarksAdd->bookmark);
$this->assertSame('Wild Swim: The best outdoor swims across Britain', $bookmarksAdd->bookmark->title);
}

Expand All @@ -34,18 +34,18 @@ public function testListingBookmarks()
$bookmarks = new Bookmarks($issuu);
$bookmarksList = $bookmarks->list();

$this->assertInternalType('object', $bookmarksList);
$this->assertIsObject($bookmarksList);

// Pagination attributes
$this->assertAttributeEquals(1, 'totalCount', $bookmarksList);
$this->assertAttributeEquals(0, 'startIndex', $bookmarksList);
$this->assertAttributeEquals(10, 'pageSize', $bookmarksList);
$this->assertAttributeEquals(false, 'more', $bookmarksList);
$this->assertSame(1, $bookmarksList->totalCount);
$this->assertSame(0, $bookmarksList->startIndex);
$this->assertSame(10, $bookmarksList->pageSize);
$this->assertSame(false, $bookmarksList->more);

// Additional checks
$this->assertInternalType('array', $bookmarksList->_content);
$this->assertIsArray($bookmarksList->_content);
$this->assertCount(1, $bookmarksList->_content);
$this->assertInternalType('object', $bookmarksList->_content[0]->bookmark);
$this->assertIsObject($bookmarksList->_content[0]->bookmark);
}

/**
Expand Down
32 changes: 16 additions & 16 deletions tests/DocumentsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ public function testListingDocuments()
$documents = new Documents($issuu);
$documentsList = $documents->list();

$this->assertInternalType('object', $documentsList);
$this->assertIsObject($documentsList);

// Pagination attributes
$this->assertAttributeEquals(1349, 'totalCount', $documentsList);
$this->assertAttributeEquals(0, 'startIndex', $documentsList);
$this->assertAttributeEquals(10, 'pageSize', $documentsList);
$this->assertAttributeEquals(true, 'more', $documentsList);
$this->assertSame(1349, $documentsList->totalCount);
$this->assertSame(0, $documentsList->startIndex);
$this->assertSame(10, $documentsList->pageSize);
$this->assertSame(true, $documentsList->more);

// Additional checks
$this->assertInternalType('array', $documentsList->_content);
$this->assertIsArray($documentsList->_content);
$this->assertCount(10, $documentsList->_content);
$this->assertInternalType('object', $documentsList->_content[0]->document);
$this->assertIsObject($documentsList->_content[0]->document);
}

/**
Expand All @@ -42,11 +42,11 @@ public function testUrlUploadingADocument()
$documents = new Documents($issuu);
$documentsUpload = $documents->urlUpload('http://www.example.com/sample.pdf');

$this->assertInternalType('object', $documentsUpload);
$this->assertIsObject($documentsUpload);

// Additional checks
$this->assertInternalType('object', $documentsUpload);
$this->assertInternalType('object', $documentsUpload->document);
$this->assertIsObject($documentsUpload);
$this->assertIsObject($documentsUpload->document);
$this->assertSame('public', $documentsUpload->document->access);
}

Expand All @@ -60,11 +60,11 @@ public function testUploadingADocument()
$documents = new Documents($issuu);
$documentsUpload = $documents->upload(__DIR__ . '/sample.pdf');

$this->assertInternalType('object', $documentsUpload);
$this->assertIsObject($documentsUpload);

// Additional checks
$this->assertInternalType('object', $documentsUpload);
$this->assertInternalType('object', $documentsUpload->document);
$this->assertIsObject($documentsUpload);
$this->assertIsObject($documentsUpload->document);
$this->assertSame('public', $documentsUpload->document->access);
}

Expand All @@ -91,11 +91,11 @@ public function testUpdatingADocument()
$documents = new Documents($issuu);
$documentsUpload = $documents->update('racing');

$this->assertInternalType('object', $documentsUpload);
$this->assertIsObject($documentsUpload);

// Additional checks
$this->assertInternalType('object', $documentsUpload);
$this->assertInternalType('object', $documentsUpload->document);
$this->assertIsObject($documentsUpload);
$this->assertIsObject($documentsUpload->document);
$this->assertSame('public', $documentsUpload->document->access);
}

Expand Down
24 changes: 12 additions & 12 deletions tests/FoldersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public function testAddingFolder()
$foldersAdd = $folders->add('Cool stuff');

// Additional checks
$this->assertInternalType('object', $foldersAdd);
$this->assertInternalType('object', $foldersAdd->folder);
$this->assertIsObject($foldersAdd);
$this->assertIsObject($foldersAdd->folder);
$this->assertSame('Stuff I have collected', $foldersAdd->folder->description);
}

Expand All @@ -34,18 +34,18 @@ public function testListingFolders()
$folders = new Folders($issuu);
$foldersList = $folders->list();

$this->assertInternalType('object', $foldersList);
$this->assertIsObject($foldersList);

// Pagination attributes
$this->assertAttributeEquals(1, 'totalCount', $foldersList);
$this->assertAttributeEquals(0, 'startIndex', $foldersList);
$this->assertAttributeEquals(10, 'pageSize', $foldersList);
$this->assertAttributeEquals(false, 'more', $foldersList);
$this->assertSame(1, $foldersList->totalCount);
$this->assertSame(0, $foldersList->startIndex);
$this->assertSame(10, $foldersList->pageSize);
$this->assertSame(false, $foldersList->more);

// Additional checks
$this->assertInternalType('array', $foldersList->_content);
$this->assertIsArray($foldersList->_content);
$this->assertCount(1, $foldersList->_content);
$this->assertInternalType('object', $foldersList->_content[0]->folder);
$this->assertIsObject($foldersList->_content[0]->folder);
}

/**
Expand All @@ -58,11 +58,11 @@ public function testUpdatingAFolder()
$folders = new Folders($issuu);
$foldersUpdate = $folders->update('4c3ba964-60c3-4349-94d0-ff86db2d47c9');

$this->assertInternalType('object', $foldersUpdate);
$this->assertIsObject($foldersUpdate);

// Additional checks
$this->assertInternalType('object', $foldersUpdate);
$this->assertInternalType('object', $foldersUpdate->folder);
$this->assertIsObject($foldersUpdate);
$this->assertIsObject($foldersUpdate->folder);
$this->assertSame('Stuff I have collected', $foldersUpdate->folder->description);
}

Expand Down

0 comments on commit 2934381

Please sign in to comment.