jonassiewertsen
1 year ago
164
2
Testing

Unit Test for Morph many to many

Posted 1 year ago by jonassiewertsen

Hej

I am looking for an elegant way for a Unit test.

my database is looking like:

categories
- id 
- name

desks
- id
- name
- something else

categoryable
- categorie_id
- categoryable_id
- categoryable_type

The morph relations itself are working. Now im pulling some arrays from the collections to test via assertEquals, which seems like a really ugly way of doing it.

$this->assertEquals()

Is there something similar way like assertInstanceOf, just for many to many relations?

$this->assertInstanceOf()

Please sign in or create an account to participate in this conversation.