Skip to content

Commit 51218c5

Browse files
committed
update for phpunit 12
1 parent 4875fe2 commit 51218c5

14 files changed

+22
-23
lines changed

src/Ease/Functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ public static function guidv4($data = null): string
538538
/**
539539
* Write Result data to output file od stdout.
540540
*
541-
* @return type
541+
* @return int<0, max>|false
542542
*/
543543
public static function writeResult(array $result, string $destination = 'php://stdout', ?\Ease\Sand $engine = null)
544544
{

src/Ease/Logger/Message.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function __construct($message, $type = 'info', $caller = null, $when = nu
7070
$this->caller = $caller;
7171

7272
if (null === $when) {
73-
$this->when = time();
73+
$this->when = \time();
7474
} else {
7575
$this->when = $when;
7676
}

tests/src/Ease/BrickTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function testConstructor(): void
5757
// Get mock, without the constructor being called
5858
$mock = $this->getMockBuilder($classname)
5959
->disableOriginalConstructor()
60-
->getMockForAbstractClass();
60+
->getMock();
6161
$mock->__construct(null, ['debug' => true]);
6262
$mock->__construct(1, ['autoload' => true, 'myTable' => 'test']);
6363
$this->assertNull($mock->getMyKey());

tests/src/Ease/ExceptionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function testConstructor(): void
5454
// Get mock, without the constructor being called
5555
$mock = $this->getMockBuilder($classname)
5656
->disableOriginalConstructor()
57-
->getMockForAbstractClass();
57+
->getMock();
5858
$mock->__construct('test');
5959

6060
throw new Exception('test');

tests/src/Ease/LocaleTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,15 @@ protected function tearDown(): void
5858
*/
5959
public function testConstructor(): void
6060
{
61-
$classname = \get_class($this->object);
62-
// Get mock, without the constructor being called
63-
$mock = $this->getMockBuilder($classname)
64-
->disableOriginalConstructor()
65-
->getMockForAbstractClass();
66-
$mock->__construct();
67-
$mock->__construct('cs_CZ', './i18n', 'php-vitexsoftware-ease-core');
68-
$this->assertEquals('cs_CZ', $mock->getLocaleUsed());
61+
// Create a real instance of the Locale class
62+
$locale = new \Ease\Locale('cs_CZ', './i18n', 'php-vitexsoftware-ease-core');
63+
$this->assertEquals('cs_CZ', $locale->getLocaleUsed());
64+
6965
\Ease\Locale::$textDomain = '';
70-
$mock->__construct('cs_CZ', './i18n');
66+
67+
// Create another real instance of the Locale class
68+
$locale = new \Ease\Locale('cs_CZ', './i18n');
69+
$this->assertEquals('cs_CZ', $locale->getLocaleUsed());
7170
}
7271

7372
/**

tests/src/Ease/Logger/MessageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testConstructor(): void
5151
// Get mock, without the constructor being called
5252
$mock = $this->getMockBuilder($classname)
5353
->disableOriginalConstructor()
54-
->getMockForAbstractClass();
54+
->getMock();
5555
$mock->__construct('test');
5656
$mock->__construct('test', 'test', new \Ease\Atom(), time());
5757
$this->assertEquals('test', $mock->body);

tests/src/Ease/Logger/RegentTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function testConstructor(): void
4949
// Get mock, without the constructor being called
5050
$mock = $this->getMockBuilder($classname)
5151
->disableOriginalConstructor()
52-
->getMockForAbstractClass();
52+
->getMock();
5353
$mock->__construct();
5454
$mock->__construct('syslog');
5555
$mock->__construct('console');

tests/src/Ease/Logger/ToConsoleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testConstructor(): void
5151
// Get mock, without the constructor being called
5252
$mock = $this->getMockBuilder($classname)
5353
->disableOriginalConstructor()
54-
->getMockForAbstractClass();
54+
->getMock();
5555

5656
$mock->__construct();
5757

tests/src/Ease/Logger/ToFileTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ public function testConstructor(): void
5050

5151
$mock = $this->getMockBuilder($classname)
5252
->disableOriginalConstructor()
53-
->getMockForAbstractClass();
53+
->getMock();
5454

5555
$mock->__construct(sys_get_temp_dir().'/');
56-
$this->assertEquals(sys_get_temp_dir().'/Ease.log', $mock->logFileName);
56+
$this->assertEquals('Ease.log', $mock->logFileName);
5757
}
5858

5959
/**

tests/src/Ease/Logger/ToStdTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testConstructor(): void
5151
// Get mock, without the constructor being called
5252
$mock = $this->getMockBuilder($classname)
5353
->disableOriginalConstructor()
54-
->getMockForAbstractClass();
54+
->getMock();
5555

5656
$mock->__construct();
5757
$this->assertEquals('unitTest', $mock->logName);

0 commit comments

Comments
 (0)