Nabble\Semalt::block PHP Метод

block() публичный статический Метод

Устаревший: Use \Nabble\SemaltBlocker\Blocker instead
public static block ( string $action = '' )
$action string If empty, send 403 response; if URL, redirect here; if non-empty string, print message
    public static function block($action = '')
    {
        SemaltBlocker\Blocker::protect($action);
    }

Usage Example

Пример #1
0
 /**
  * @depends testBlocked
  */
 public function testBlock()
 {
     $this->mockGoodReferer();
     ob_start();
     $goodReferer = \Nabble\Semalt::block();
     $output = ob_get_clean();
     $this->assertNull($goodReferer, 'Shouldn\'t return anything');
     $this->assertEmpty($output, 'Shouldn\'t output anything');
     $this->mockBadReferer();
     ob_start();
     $withoutAction = \Nabble\Semalt::block();
     $output = ob_get_clean();
     $explodedExplanation = explode('%s', \Nabble\Semalt::$explanation);
     $this->assertNull($withoutAction, 'Shouldn\'t return anything');
     $this->assertNotNull($output, 'Output shouldn\'t be null');
     $this->assertContains($explodedExplanation[0], $output, 'Should contain explanation');
     ob_start();
     $withMessage = \Nabble\Semalt::block('TEST_MESSAGE');
     $output = ob_get_clean();
     $this->assertNull($withMessage, 'Shouldn\'t return anything');
     $this->assertNotNull($output, 'Output shouldn\'t be null');
     $this->assertContains('TEST_MESSAGE', $output, 'Should contain test message');
     // @todo test headers
 }
All Usage Examples Of Nabble\Semalt::block
Semalt