Change coding style in email editor tests to WordPress
This commit contains automated changes made with phpcbf command from CodeSniffer package. [MAILPOET-6240]
This commit is contained in:
@@ -7,41 +7,47 @@ use PHPUnit\Framework\TestCase;
|
||||
use stdClass;
|
||||
|
||||
class Container_Test extends TestCase {
|
||||
public function testSetAndGetService(): void {
|
||||
$container = new Container();
|
||||
public function testSetAndGetService(): void {
|
||||
$container = new Container();
|
||||
|
||||
$container->set('simple_service', function () {
|
||||
return new stdClass();
|
||||
});
|
||||
$container->set(
|
||||
'simple_service',
|
||||
function () {
|
||||
return new stdClass();
|
||||
}
|
||||
);
|
||||
|
||||
$service = $container->get('simple_service');
|
||||
$service = $container->get( 'simple_service' );
|
||||
|
||||
$this->assertInstanceOf(stdClass::class, $service);
|
||||
}
|
||||
$this->assertInstanceOf( stdClass::class, $service );
|
||||
}
|
||||
|
||||
public function testGetReturnsSameInstance(): void {
|
||||
$container = new Container();
|
||||
public function testGetReturnsSameInstance(): void {
|
||||
$container = new Container();
|
||||
|
||||
$container->set('singleton_service', function () {
|
||||
return new stdClass();
|
||||
});
|
||||
$container->set(
|
||||
'singleton_service',
|
||||
function () {
|
||||
return new stdClass();
|
||||
}
|
||||
);
|
||||
|
||||
// Retrieve the service twice
|
||||
$service1 = $container->get('singleton_service');
|
||||
$service2 = $container->get('singleton_service');
|
||||
// Retrieve the service twice
|
||||
$service1 = $container->get( 'singleton_service' );
|
||||
$service2 = $container->get( 'singleton_service' );
|
||||
|
||||
// Check that both instances are the same
|
||||
$this->assertSame($service1, $service2);
|
||||
}
|
||||
// Check that both instances are the same
|
||||
$this->assertSame( $service1, $service2 );
|
||||
}
|
||||
|
||||
public function testExceptionForNonExistingService(): void {
|
||||
// Create the container instance
|
||||
$container = new Container();
|
||||
public function testExceptionForNonExistingService(): void {
|
||||
// Create the container instance
|
||||
$container = new Container();
|
||||
|
||||
// Attempt to get a non-existing service should throw an exception
|
||||
$this->expectException(Exception::class);
|
||||
$this->expectExceptionMessage('Service not found: non_existing_service');
|
||||
// Attempt to get a non-existing service should throw an exception
|
||||
$this->expectException( Exception::class );
|
||||
$this->expectExceptionMessage( 'Service not found: non_existing_service' );
|
||||
|
||||
$container->get('non_existing_service');
|
||||
}
|
||||
$container->get( 'non_existing_service' );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user