Skip to content

Commit

Permalink
fix phpbench tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Oct 12, 2024
1 parent c7e5605 commit 7c9b742
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\Performance\EntityManagerFactory;
use Doctrine\Tests\Mocks\ArrayResultFactory;
use Doctrine\Tests\Models\CMS\CmsAddress;
use Doctrine\Tests\Models\CMS\CmsPhonenumber;
use Doctrine\Tests\Models\CMS\CmsUser;
use PhpBench\Benchmark\Metadata\Annotations\BeforeMethods;
Expand All @@ -33,6 +34,7 @@ public function init(): void
'u__name' => 'Roman',
'sclr0' => 'ROMANB',
'p__phonenumber' => '42',
'a__id' => '1',
],
[
'u__id' => '1',
Expand All @@ -41,6 +43,7 @@ public function init(): void
'u__name' => 'Roman',
'sclr0' => 'ROMANB',
'p__phonenumber' => '43',
'a__id' => '1',
],
[
'u__id' => '2',
Expand All @@ -49,6 +52,7 @@ public function init(): void
'u__name' => 'Roman',
'sclr0' => 'JWAGE',
'p__phonenumber' => '91',
'a__id' => '1',
],
];

Expand All @@ -60,6 +64,7 @@ public function init(): void
'u__name' => 'Jonathan',
'sclr0' => 'JWAGE' . $i,
'p__phonenumber' => '91',
'a__id' => '1',
];
}

Expand All @@ -75,6 +80,8 @@ public function init(): void
$this->rsm->addFieldResult('u', 'u__name', 'name');
$this->rsm->addScalarResult('sclr0', 'nameUpper');
$this->rsm->addFieldResult('p', 'p__phonenumber', 'phonenumber');
$this->rsm->addJoinedEntityResult(CmsAddress::class, 'a', 'u', 'address');
$this->rsm->addFieldResult('a', 'a__id', 'id');
}

public function benchHydration(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\Performance\EntityManagerFactory;
use Doctrine\Tests\Mocks\ArrayResultFactory;
use Doctrine\Tests\Models\CMS\CmsAddress;
use Doctrine\Tests\Models\CMS\CmsUser;
use PhpBench\Benchmark\Metadata\Annotations\BeforeMethods;

Expand All @@ -30,18 +31,21 @@ public function init(): void
'u__status' => 'developer',
'u__username' => 'romanb',
'u__name' => 'Roman',
'a__id' => '1',
],
[
'u__id' => '1',
'u__status' => 'developer',
'u__username' => 'romanb',
'u__name' => 'Roman',
'a__id' => '1',
],
[
'u__id' => '2',
'u__status' => 'developer',
'u__username' => 'romanb',
'u__name' => 'Roman',
'a__id' => '1',
],
];

Expand All @@ -51,6 +55,7 @@ public function init(): void
'u__status' => 'developer',
'u__username' => 'jwage',
'u__name' => 'Jonathan',
'a__id' => '1',
];
}

Expand All @@ -63,6 +68,8 @@ public function init(): void
$this->rsm->addFieldResult('u', 'u__status', 'status');
$this->rsm->addFieldResult('u', 'u__username', 'username');
$this->rsm->addFieldResult('u', 'u__name', 'name');
$this->rsm->addJoinedEntityResult(CmsAddress::class, 'a', 'u', 'address');
$this->rsm->addFieldResult('a', 'a__id', 'id');
}

public function benchHydration(): void
Expand Down

0 comments on commit 7c9b742

Please sign in to comment.