Skip to content

Commit

Permalink
add php8.3 to drone (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
heelc29 authored Aug 16, 2024
1 parent cbbff82 commit c1444f7
Show file tree
Hide file tree
Showing 13 changed files with 1,747 additions and 1,741 deletions.
3 changes: 2 additions & 1 deletion .drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ local composer(phpversion, params) = {
local phpunit(phpversion) = {
name: "PHPUnit",
image: "joomlaprojects/docker-images:php" + phpversion,
[if phpversion == "8.3" then "failure"]: "ignore",
[if phpversion == "8.4" then "failure"]: "ignore",
commands: ["vendor/bin/phpunit"]
};

Expand Down Expand Up @@ -103,4 +103,5 @@ local pipeline(name, phpversion, params) = {
pipeline("8.1 lowest", "8.1", "--prefer-stable --prefer-lowest"),
pipeline("8.1", "8.1", "--prefer-stable"),
pipeline("8.2", "8.2", "--prefer-stable"),
pipeline("8.3", "8.3", "--prefer-stable"),
]
22 changes: 21 additions & 1 deletion .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,27 @@ volumes:
path: /tmp/composer-cache
name: composer-cache
---
kind: pipeline
name: PHP 8.3
steps:
- commands:
- php -v
- composer update --prefer-stable
image: joomlaprojects/docker-images:php8.3
name: composer
volumes:
- name: composer-cache
path: /tmp/composer-cache
- commands:
- vendor/bin/phpunit
image: joomlaprojects/docker-images:php8.3
name: PHPUnit
volumes:
- host:
path: /tmp/composer-cache
name: composer-cache
---
kind: signature
hmac: 2bbb5bc788059cf5dd4cbb4fcc3f11adec8bfa59fc10526fd37c74d6ca472da7
hmac: 44494eb95c9ccb71ac8b365e9422d0fd3e0dd946a21c606f70ac73952fe01bc6

...
312 changes: 156 additions & 156 deletions Tests/AbstractEventTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,160 +18,160 @@
*/
class AbstractEventTest extends TestCase
{
/**
* @testdox The event's name can be retrieved
*
* @covers Joomla\Event\AbstractEvent
*/
public function testGetName()
{
$this->assertEquals('test', $this->createEventWithoutArguments()->getName());
}

/**
* @testdox A named event argument can be retrieved
*
* @covers Joomla\Event\AbstractEvent
*/
public function testGetArgument()
{
$event = $this->createEventWithArguments();

$this->assertFalse($event->getArgument('non-existing', false));
$this->assertSame('bar', $event->getArgument('string'));
$this->assertInstanceOf(\stdClass::class, $event->getArgument('object'));
$this->assertIsArray($event->getArgument('array'));
}

/**
* @testdox The event can be checked for a named argument
*
* @covers Joomla\Event\AbstractEvent
*/
public function testHasArgument()
{
$event = $this->createEventWithArguments();

$this->assertFalse($event->hasArgument('non-existing'));
$this->assertTrue($event->hasArgument('string'));
}

/**
* @testdox The event arguments can be retrieved
*
* @covers Joomla\Event\AbstractEvent
*/
public function testGetArguments()
{
$this->assertEmpty($this->createEventWithoutArguments()->getArguments());
}

/**
* @testdox The event can be checked if its propagation has been stopped
*
* @covers Joomla\Event\AbstractEvent
*/
public function testIsStopped()
{
$this->assertFalse($this->createEventWithoutArguments()->isStopped());
}

/**
* @testdox An event's propagation can be stopped
*
* @covers Joomla\Event\AbstractEvent
*/
public function testStopPropagation()
{
$event = $this->createEventWithoutArguments();

$event->stopPropagation();
$this->assertTrue($event->isStopped());
}

/**
* @testdox The event arguments can be counted
*
* @covers Joomla\Event\AbstractEvent
*/
public function testCount()
{
$this->assertCount(3, $this->createEventWithArguments());
}

/**
* @testdox The event can be serialized and unserialized
*
* @covers Joomla\Event\AbstractEvent
*/
public function testSerializeUnserialize()
{
$event = $this->createEventWithArguments();

$this->assertEquals($event, unserialize(serialize($event)));
}

/**
* @testdox The event arguments can be checked for presence when accessing the event as an array
*
* @covers Joomla\Event\AbstractEvent
*/
public function testOffsetExists()
{
$event = $this->createEventWithArguments();

$this->assertFalse(isset($event['non-existing']));
$this->assertTrue(isset($event['string']));
}

/**
* @testdox The event arguments can be retrieved when accessing the event as an array
*
* @covers Joomla\Event\AbstractEvent
*/
public function testOffsetGet()
{
$event = $this->createEventWithArguments();

$this->assertNull($event['non-existing']);
$this->assertSame('bar', $event['string']);
$this->assertInstanceOf(\stdClass::class, $event['object']);
$this->assertIsArray($event['array']);
}

/**
* Creates an event without any arguments
*
* @return AbstractEvent|MockObject
*/
private function createEventWithoutArguments(): AbstractEvent
{
return $this->getMockForAbstractClass(AbstractEvent::class, ['test']);
}

/**
* Creates an event with some arguments
*
* @return AbstractEvent|MockObject
*/
private function createEventWithArguments(): AbstractEvent
{
return $this->getMockForAbstractClass(
AbstractEvent::class,
[
'test',
[
'string' => 'bar',
'object' => new \stdClass,
'array' => [
'foo' => 'bar',
'test' => [
'foo' => 'bar',
'test' => 'test',
],
],
],
]
);
}
/**
* @testdox The event's name can be retrieved
*
* @covers Joomla\Event\AbstractEvent
*/
public function testGetName()
{
$this->assertEquals('test', $this->createEventWithoutArguments()->getName());
}

/**
* @testdox A named event argument can be retrieved
*
* @covers Joomla\Event\AbstractEvent
*/
public function testGetArgument()
{
$event = $this->createEventWithArguments();

$this->assertFalse($event->getArgument('non-existing', false));
$this->assertSame('bar', $event->getArgument('string'));
$this->assertInstanceOf(\stdClass::class, $event->getArgument('object'));
$this->assertIsArray($event->getArgument('array'));
}

/**
* @testdox The event can be checked for a named argument
*
* @covers Joomla\Event\AbstractEvent
*/
public function testHasArgument()
{
$event = $this->createEventWithArguments();

$this->assertFalse($event->hasArgument('non-existing'));
$this->assertTrue($event->hasArgument('string'));
}

/**
* @testdox The event arguments can be retrieved
*
* @covers Joomla\Event\AbstractEvent
*/
public function testGetArguments()
{
$this->assertEmpty($this->createEventWithoutArguments()->getArguments());
}

/**
* @testdox The event can be checked if its propagation has been stopped
*
* @covers Joomla\Event\AbstractEvent
*/
public function testIsStopped()
{
$this->assertFalse($this->createEventWithoutArguments()->isStopped());
}

/**
* @testdox An event's propagation can be stopped
*
* @covers Joomla\Event\AbstractEvent
*/
public function testStopPropagation()
{
$event = $this->createEventWithoutArguments();

$event->stopPropagation();
$this->assertTrue($event->isStopped());
}

/**
* @testdox The event arguments can be counted
*
* @covers Joomla\Event\AbstractEvent
*/
public function testCount()
{
$this->assertCount(3, $this->createEventWithArguments());
}

/**
* @testdox The event can be serialized and unserialized
*
* @covers Joomla\Event\AbstractEvent
*/
public function testSerializeUnserialize()
{
$event = $this->createEventWithArguments();

$this->assertEquals($event, unserialize(serialize($event)));
}

/**
* @testdox The event arguments can be checked for presence when accessing the event as an array
*
* @covers Joomla\Event\AbstractEvent
*/
public function testOffsetExists()
{
$event = $this->createEventWithArguments();

$this->assertFalse(isset($event['non-existing']));
$this->assertTrue(isset($event['string']));
}

/**
* @testdox The event arguments can be retrieved when accessing the event as an array
*
* @covers Joomla\Event\AbstractEvent
*/
public function testOffsetGet()
{
$event = $this->createEventWithArguments();

$this->assertNull($event['non-existing']);
$this->assertSame('bar', $event['string']);
$this->assertInstanceOf(\stdClass::class, $event['object']);
$this->assertIsArray($event['array']);
}

/**
* Creates an event without any arguments
*
* @return AbstractEvent|MockObject
*/
private function createEventWithoutArguments(): AbstractEvent
{
return $this->getMockForAbstractClass(AbstractEvent::class, ['test']);
}

/**
* Creates an event with some arguments
*
* @return AbstractEvent|MockObject
*/
private function createEventWithArguments(): AbstractEvent
{
return $this->getMockForAbstractClass(
AbstractEvent::class,
[
'test',
[
'string' => 'bar',
'object' => new \stdClass(),
'array' => [
'foo' => 'bar',
'test' => [
'foo' => 'bar',
'test' => 'test',
],
],
],
]
);
}
}
Loading

0 comments on commit c1444f7

Please sign in to comment.