/** * Check to see if we're calling an informative alert * * @param string $method The function called * @param array $parameters Its parameters * * @return Alert */ public static function __callStatic($method, $parameters) { // Extract real method and type of alert $method = explode('_', $method); // Search for "open_type" method $open = array_search('open', $method); if ($closable = $open !== false) { unset($method[$open]); } // Search for "block_type" method $block = array_search('block', $method); if ($blockType = $block !== false) { unset($method[$block]); } $type = 'alert-' . implode('-', $method); $message = array_get($parameters, 0); $attributes = array_get($parameters, 1); $instance = Alert::show($type, $message, $attributes); $instance->open(!$closable); $instance->block($blockType); return $instance; }
public function testCanDoWhateverTheFuckIWant() { $alert = Alert::foo_bar('foo', $this->testAttributes); $match = $this->createMatcher('foo-bar'); $this->assertHTML($match, $alert); }