|
|
@@ -3391,8 +3391,19 @@ class TableTest extends TestCase
|
|
|
public function testCallbackArgumentTypes()
|
|
|
{
|
|
|
$table = TableRegistry::get('articles');
|
|
|
+ $table->belongsTo('authors');
|
|
|
+
|
|
|
$eventManager = $table->eventManager();
|
|
|
|
|
|
+ $associationBeforeFindCount = 0;
|
|
|
+ $table->association('authors')->target()->eventManager()->attach(
|
|
|
+ function (Event $event, Query $query, ArrayObject $options, $primary) use (&$associationBeforeFindCount) {
|
|
|
+ $this->assertTrue(is_bool($primary));
|
|
|
+ $associationBeforeFindCount ++;
|
|
|
+ },
|
|
|
+ 'Model.beforeFind'
|
|
|
+ );
|
|
|
+
|
|
|
$beforeFindCount = 0;
|
|
|
$eventManager->attach(
|
|
|
function (Event $event, Query $query, ArrayObject $options, $primary) use (&$beforeFindCount) {
|
|
|
@@ -3401,7 +3412,8 @@ class TableTest extends TestCase
|
|
|
},
|
|
|
'Model.beforeFind'
|
|
|
);
|
|
|
- $table->find()->first();
|
|
|
+ $table->find()->contain('authors')->first();
|
|
|
+ $this->assertEquals(1, $associationBeforeFindCount);
|
|
|
$this->assertEquals(1, $beforeFindCount);
|
|
|
|
|
|
$buildValidatorCount = 0;
|