Update to PHP 8.4, new option lib
This commit is contained in:
@@ -22,7 +22,7 @@ class ArrayMapperTest extends TestCase
|
||||
public function testMapSucceeds(): void
|
||||
{
|
||||
$result = ['one' => 2, 'three' => 4, 'eight' => 'five'];
|
||||
$mapped = (new ArrayMapper())->map($result);
|
||||
$mapped = new ArrayMapper()->map($result);
|
||||
$this->assertSame($result, $mapped, 'The array mapper should return the parameter given to it');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ class CountMapperTest extends TestCase
|
||||
#[TestDox('map() succeeds')]
|
||||
public function testMapSucceeds(): void
|
||||
{
|
||||
$this->assertEquals(5, (new CountMapper())->map([5, 8, 10]), 'Count not correct');
|
||||
$this->assertEquals(5, new CountMapper()->map([5, 8, 10]), 'Count not correct');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class DocumentMapperTest extends TestCase
|
||||
#[TestDox('map() succeeds with valid JSON')]
|
||||
public function testMapSucceedsWithValidJSON(): void
|
||||
{
|
||||
$doc = (new DocumentMapper(TestDocument::class))->map(['data' => '{"id":7,"subDoc":{"id":22,"name":"tester"}}']);
|
||||
$doc = new DocumentMapper(TestDocument::class)->map(['data' => '{"id":7,"subDoc":{"id":22,"name":"tester"}}']);
|
||||
$this->assertNotNull($doc, 'The document should not have been null');
|
||||
$this->assertEquals(7, $doc->id, 'ID not filled correctly');
|
||||
$this->assertNotNull($doc->subDoc, 'The sub-document should not have been null');
|
||||
@@ -58,7 +58,7 @@ class DocumentMapperTest extends TestCase
|
||||
#[TestDox('map() succeeds with valid JSON for Pjson class')]
|
||||
public function testMapSucceedsWithValidJSONForPjsonClass(): void
|
||||
{
|
||||
$doc = (new DocumentMapper(PjsonDocument::class))->map(['data' => '{"id":"seven","name":"bob","num_value":8}']);
|
||||
$doc = new DocumentMapper(PjsonDocument::class)->map(['data' => '{"id":"seven","name":"bob","num_value":8}']);
|
||||
$this->assertNotNull($doc, 'The document should not have been null');
|
||||
$this->assertEquals(new PjsonId('seven'), $doc->id, 'ID not filled correctly');
|
||||
$this->assertEquals('bob', $doc->name, 'Name not filled correctly');
|
||||
@@ -70,13 +70,13 @@ class DocumentMapperTest extends TestCase
|
||||
public function testMapFailsWithInvalidJSON(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
(new DocumentMapper(TestDocument::class))->map(['data' => 'this is not valid']);
|
||||
new DocumentMapper(TestDocument::class)->map(['data' => 'this is not valid']);
|
||||
}
|
||||
|
||||
#[TestDox('map() fails with invalid JSON for Pjson class')]
|
||||
public function testMapFailsWithInvalidJSONForPjsonClass(): void
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
(new DocumentMapper(PjsonDocument::class))->map(['data' => 'not even close']);
|
||||
new DocumentMapper(PjsonDocument::class)->map(['data' => 'not even close']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class ExistsMapperTest extends TestCase
|
||||
{
|
||||
try {
|
||||
Configuration::overrideMode(Mode::PgSQL);
|
||||
$this->assertFalse((new ExistsMapper())->map([false, 'nope']), 'Result should have been false');
|
||||
$this->assertFalse(new ExistsMapper()->map([false, 'nope']), 'Result should have been false');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
@@ -35,7 +35,7 @@ class ExistsMapperTest extends TestCase
|
||||
{
|
||||
try {
|
||||
Configuration::overrideMode(Mode::SQLite);
|
||||
$this->assertTrue((new ExistsMapper())->map([1, 'yep']), 'Result should have been true');
|
||||
$this->assertTrue(new ExistsMapper()->map([1, 'yep']), 'Result should have been true');
|
||||
} finally {
|
||||
Configuration::overrideMode(null);
|
||||
}
|
||||
@@ -46,6 +46,6 @@ class ExistsMapperTest extends TestCase
|
||||
{
|
||||
$this->expectException(DocumentException::class);
|
||||
Configuration::overrideMode(null);
|
||||
(new ExistsMapper())->map(['0']);
|
||||
new ExistsMapper()->map(['0']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user