Esempio n. 1
0
    /**
     * 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 testStaticWhatever()
 {
     $alert = Alert::foo_bar('foo', $this->testAttributes);
     $match = $this->createMatcher('foo-bar');
     $this->assertTag($match, $alert);
 }
Esempio n. 3
0
 /**
  * Adds the given classes to attributes
  *
  * @param array $classes
  * @return $this 
  * @static 
  */
 public static function addClass($classes)
 {
     //Method inherited from \Bootstrapper\RenderedObject
     return \Bootstrapper\Alert::addClass($classes);
 }
Esempio n. 4
0
    public function testCanDoWhateverTheFuckIWant()
    {
        $alert = Alert::foo_bar('foo', $this->testAttributes);
        $match = $this->createMatcher('foo-bar');

        $this->assertHTML($match, $alert);
    }