enable() public static method

Enables/disables the filter system.
public static enable ( boolean $active = true )
$active boolean
Beispiel #1
0
             Filter::detach($this->mock, 'filterable', 'spec.my_prefix');
             expect($this->mock->filterable('World!'))->toBe('Hello World!');
         });
     });
     describe("::filters()", function () {
         it("gets filters of a context", function () {
             Filter::apply($this->mock, 'filterable', 'spec.my_prefix');
             $filters = Filter::filters($this->mock, 'filterable');
             expect($filters)->toBeAn('array')->toHaveLength(1);
             expect(reset($filters))->toBeAnInstanceOf('Closure');
         });
     });
     describe("::enable()", function () {
         it("disables the filter system", function () {
             Filter::apply($this->mock, 'filterable', 'spec.my_prefix');
             Filter::enable(false);
             expect($this->mock->filterable('World!'))->toBe('Hello World!');
         });
     });
 });
 context("with a class context", function () {
     beforeEach(function () {
         $this->class = Stub::classname();
         Stub::on($this->class)->method('::filterable', function () {
             return Filter::on(get_called_class(), 'filterable', func_get_args(), function ($chain, $message) {
                 return "Hello {$message}";
             });
         });
     });
     describe("::apply()", function () {
         it("applies a filter and override a parameter", function () {