From 02f5af9ca7717a900e3011d05688ac40f0b3f6ca Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Thu, 20 Oct 2016 14:57:43 -0500 Subject: [PATCH] Showing that formatResults on belongsToMany doesn't work --- tests/TestCase/ORM/QueryTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/TestCase/ORM/QueryTest.php b/tests/TestCase/ORM/QueryTest.php index 3bd3fe819bd..34a87a41d9c 100644 --- a/tests/TestCase/ORM/QueryTest.php +++ b/tests/TestCase/ORM/QueryTest.php @@ -1312,6 +1312,7 @@ public function testFormatResultsBelongsToMany() ->eventManager() ->attach(function ($event, $query) { $query->formatResults(function ($results) { + $results->beforeFind = true; return $results; }); }, 'Model.beforeFind'); @@ -1335,6 +1336,7 @@ public function testFormatResultsBelongsToMany() '_joinData' => ['article_id' => 1, 'tag_id' => 1], 'description' => 'A big description', 'created' => new Time('2016-01-01 00:00'), + 'beforeFind' => true, ]; $this->assertEquals($expected, $first->tags[0]->toArray()); $this->assertInstanceOf(Time::class, $first->tags[0]->created); @@ -1345,6 +1347,7 @@ public function testFormatResultsBelongsToMany() '_joinData' => ['article_id' => 1, 'tag_id' => 2], 'description' => 'Another big description', 'created' => new Time('2016-01-01 00:00'), + 'beforeFind' => true, ]; $this->assertEquals($expected, $first->tags[1]->toArray()); $this->assertInstanceOf(Time::class, $first->tags[0]->created);