Skip to content

Commit

Permalink
Update for php 8
Browse files Browse the repository at this point in the history
  • Loading branch information
exussum12 committed Jul 17, 2024
1 parent d049031 commit 936ac59
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 45 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "exussum12/trip-advisor",
"description": "PHP implementation of review API",
"require-dev": {
"phpunit/phpunit": "^5.7"
"phpunit/phpunit": "^9.0"
},
"license": "MIT",
"authors": [
Expand Down
46 changes: 17 additions & 29 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.7/phpunit.xsd"
bootstrap="tests/autoload.php"
backupGlobals="false"
beStrictAboutCoversAnnotation="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutTodoAnnotatedTests="true"
verbose="true">
<testsuite>
<directory suffix="Test.php">tests</directory>
</testsuite>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
<exclude>
<directory suffix=".php">src/Clients</directory>
</exclude>
</whitelist>
</filter>
<logging>
<log
type="coverage-html"
target="report"
lowUpperBound="35"
highLowerBound="70"/>
<log type="coverage-clover" target="report/coverage.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd" bootstrap="tests/autoload.php" backupGlobals="false" beStrictAboutCoversAnnotation="true" beStrictAboutOutputDuringTests="true" beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutTodoAnnotatedTests="true" convertDeprecationsToExceptions="true" verbose="true">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory suffix=".php">src/Clients</directory>
</exclude>
<report>
<clover outputFile="report/coverage.xml"/>
<html outputDirectory="report" lowUpperBound="35" highLowerBound="70"/>
</report>
</coverage>
<testsuite name="tests">
<directory suffix="Test.php">tests</directory>
</testsuite>
<logging/>
</phpunit>
14 changes: 7 additions & 7 deletions src/ResultSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ public function __construct(Reviews $reviews, array $startingArray)
$this->reviews = $reviews;
}

public function current()
public function current(): mixed
{
return $this->array[$this->current];
}

public function next()
public function next(): void
{
$this->current++;
}

public function key()
public function key(): mixed
{
return $this->current;
}

public function valid()
public function valid(): bool
{
if (isset($this->array[$this->current])) {
return true;
Expand All @@ -55,17 +55,17 @@ public function valid()
return false;
}

public function rewind()
public function rewind(): void
{
$this->current = 0;
}

public function getArray()
public function getArray(): array
{
return $this->array;
}

public function count()
public function count():int
{
return count($this->array);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Reviews.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function limit($limit)
return $this;
}

public function get($time = null)
public function get($time = '')
{
$url = parse_url(static::URL);
$args = http_build_query($this->urlArgs);
Expand Down
8 changes: 2 additions & 6 deletions tests/ResultSetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@

class ResultSetTest extends TestCase
{
public function setUp()
{
parent::setUp();
}

public function testInitialLoad()
{
$review = $this->createMock(Reviews::class);

$resultSet = new ResultSetTest($review, []);
$resultSet = new ResultSet($review, []);

$this->assertInstanceOf(ResultSetTest::class, $resultSet);
$this->assertInstanceOf(ResultSet::class, $resultSet);
}

public function testCountable()
Expand Down
2 changes: 1 addition & 1 deletion tests/ReviewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ReviewsTest extends TestCase
/** @var Reviews */
protected $reviews;

public function setUp()
public function setUp(): void
{
parent::setUp();
$this->client = $this->getMockBuilder(Client::class)->getMock();
Expand Down

0 comments on commit 936ac59

Please sign in to comment.