public function testToString() { $group = $this->getMock('Oro\\Bundle\\UserBundle\\Entity\\Group'); $user = $this->getMock('Oro\\Bundle\\UserBundle\\Entity\\User'); // test when owner filled $this->entity->setOwner(true); $this->assertInternalType('string', $this->entity->__toString()); $this->assertNotEmpty($this->entity->__toString()); // clear owner $this->entity->setOwner(null); // test when email filled $this->entity->setEmail('test email'); $this->assertInternalType('string', $this->entity->__toString()); $this->assertNotEmpty($this->entity->__toString()); // clear email $this->entity->setEmail(null); // test when users filled $this->entity->addUser($user); $this->assertInternalType('string', $this->entity->__toString()); $this->assertNotEmpty($this->entity->__toString()); // clear users $this->entity->getUsers()->clear(); // test when groups filled $this->entity->addGroup($group); $this->assertInternalType('string', $this->entity->__toString()); $this->assertNotEmpty($this->entity->__toString()); // clear groups $this->entity->getGroups()->clear(); // should be empty if nothing filled $this->assertEmpty($this->entity->__toString()); }