public function test_can_add_a_badge_instance() { $badge = new DefaultBadge($this->container); $badge->setValue(1); $this->item->addBadge($badge); $this->assertInstanceOf('Illuminate\\Support\\Collection', $this->item->getBadges()); $this->assertCount(1, $this->item->getBadges()); $this->assertEquals('1', $this->item->getBadges()->first()->getValue()); }
public function test_badge_can_be_cached() { $this->badge->setValue('value'); $this->badge->setClass('class'); $serialized = serialize($this->badge); $unserialized = unserialize($serialized); $this->assertInstanceOf('Maatwebsite\\Sidebar\\Badge', $unserialized); $this->assertEquals('value', $unserialized->getValue()); $this->assertEquals('class', $unserialized->getClass()); }