Skip to content

Commit

Permalink
PHP 8.3
Browse files Browse the repository at this point in the history
  • Loading branch information
phpfui committed Nov 23, 2023
1 parent de65d1e commit cb53d9f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: true
matrix:
php: [8.2, 8.1, 8.0]
php: [8.3, 8.2, 8.1, 8.0]
dependency-version: [prefer-stable]
os: [ubuntu-latest, windows-latest]

Expand Down
74 changes: 37 additions & 37 deletions Tests/DefinitionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,6 @@ public function testBadClassType() : void
$fixture->class = new \DateTime();
}

public function testClassAssignedInt() : void
{
$fixture = new \Tests\Fixtures\Type();
$this->expectException(\PHPFUI\ConstantContact\Exception\InvalidType::class);
$fixture->class = 1;
}

public function testClassAssignedString() : void
{
$fixture = new \Tests\Fixtures\Type();
$this->expectException(\PHPFUI\ConstantContact\Exception\InvalidType::class);
$fixture->class = 'class';
}

public function testBadEnum() : void
{
$fixture = new \Tests\Fixtures\Type();
Expand Down Expand Up @@ -153,6 +139,20 @@ public function testClassArraySizeMin() : void
$this->assertCount(2, $fixture->classArraySizeMin);
}

public function testClassAssignedInt() : void
{
$fixture = new \Tests\Fixtures\Type();
$this->expectException(\PHPFUI\ConstantContact\Exception\InvalidType::class);
$fixture->class = 1;
}

public function testClassAssignedString() : void
{
$fixture = new \Tests\Fixtures\Type();
$this->expectException(\PHPFUI\ConstantContact\Exception\InvalidType::class);
$fixture->class = 'class';
}

public function testConstructFromArray() : void
{
$original = [
Expand Down Expand Up @@ -181,6 +181,29 @@ public function testConstructFromObject() : void
$this->assertEquals($testClass, $fixture->class);
}

public function testDefaultObjects() : void
{
$address = [];
$address['created_at'] = (string)new \PHPFUI\ConstantContact\DateTime();
$address['permission_to_send'] = 'explicit';

$email_address = new \PHPFUI\ConstantContact\Definition\EmailAddressPut($address);
$contact = ['email_address' => $email_address];

$contactBody = new \PHPFUI\ConstantContact\Definition\ContactPutRequest($contact);
$contactBody->update_source = 'Account';
$contactBody->street_addresses = [new \PHPFUI\ConstantContact\Definition\StreetAddressPut([
'kind' => 'home',
'street' => 'address',
'city' => 'town',
'state' => 'state',
'postal_code' => 'zip',
'country' => 'USA', ])];
$json = $contactBody->getJSON();

$this->assertStringContainsString('created_at', $json);
}

public function testGeneratedClass() : void
{
$fixture = new \PHPFUI\ConstantContact\Definition\EmailCampaignActivity();
Expand Down Expand Up @@ -270,27 +293,4 @@ public function testMinLength() : void
$this->expectException(\PHPFUI\ConstantContact\Exception\InvalidLength::class);
$fixture->string = 'fred';
}

public function testDefaultObjects() : void
{
$address = [];
$address['created_at'] = (string)new \PHPFUI\ConstantContact\DateTime();
$address['permission_to_send'] = 'explicit';

$email_address = new \PHPFUI\ConstantContact\Definition\EmailAddressPut($address);
$contact = ['email_address' => $email_address];

$contactBody = new \PHPFUI\ConstantContact\Definition\ContactPutRequest($contact);
$contactBody->update_source = 'Account';
$contactBody->street_addresses = [new \PHPFUI\ConstantContact\Definition\StreetAddressPut([
'kind' => 'home',
'street' => 'address',
'city' => 'town',
'state' => 'state',
'postal_code' => 'zip',
'country' => 'USA', ])];
$json = $contactBody->getJSON();

$this->assertStringContainsString('created_at', $json);
}
}
1 change: 1 addition & 0 deletions Tool/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ private function deleteFileTree(string $path) : void
if (! $item->isDir())
{
$fileName = "{$item}";

// don't delete base classes
if (! \str_ends_with($fileName, 'Base.php'))
{
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"require": {
"php": ">=8.0 <8.3",
"php": ">=8.0 <8.4",
"guzzlehttp/guzzle": "^7.3",
"spatie/guzzle-rate-limiter-middleware": "^2.0"
},
Expand Down

0 comments on commit cb53d9f

Please sign in to comment.