Browse Source

Updated the assertion to an array comparison

David Yell 11 years ago
parent
commit
ac8ccae780
1 changed files with 3 additions and 7 deletions
  1. 3 7
      tests/TestCase/ORM/AssociationCollectionTest.php

+ 3 - 7
tests/TestCase/ORM/AssociationCollectionTest.php

@@ -380,12 +380,8 @@ class AssociationCollectionTest extends TestCase
         $belongsToMany = new BelongsToMany('');
         $this->associations->add('Cart', $belongsToMany);
 
-        foreach ($this->associations as $name => $association) {
-            if ($name === 'users') {
-                $this->assertInstanceOf('Cake\ORM\Association\BelongsTo', $association);
-            } else {
-                $this->assertInstanceOf('Cake\ORM\Association\BelongsToMany', $association);
-            }
-        }
+        $expected = ['users' => $belongsTo, 'cart' => $belongsToMany];
+        $result = iterator_to_array($this->associations, true);
+        $this->assertSame($expected, $result);
     }
 }