Example #1
0
 /**
  * Test for the render() method.
  *
  * @return void
  */
 public function test_render()
 {
     $testee = new Testee();
     $action = 'action';
     $name = 'name';
     Monkey\Functions::when('sanitize_title_with_dashes')->returnArg();
     $context = new Context($action, $name);
     $nonce = 'nonce';
     Monkey\Functions::expect('wp_create_nonce')->with($action)->andReturn($nonce);
     Monkey\Functions::when('esc_attr')->returnArg();
     $this->expectOutputString("data-{$name}=\"{$nonce}\"");
     $testee->render($context);
 }
Example #2
0
 /**
  * Test for the render() method.
  *
  * @return void
  */
 public function test_render()
 {
     $testee = new Testee();
     $action = 'action';
     $nonce = 'nonce';
     Monkey\Functions::expect('wp_create_nonce')->with($action)->andReturn($nonce);
     $name = 'name';
     /** @var Context $context */
     $context = Mockery::mock('Inpsyde\\Nonces\\Context')->shouldReceive('get_action')->andReturn($action)->shouldReceive('get_name')->andReturn($name)->getMock();
     Monkey\Functions::when('esc_attr')->returnArg();
     $this->expectOutputString("data-{$name}=\"{$nonce}\"");
     $testee->render($context);
 }