/** * Test for the get() method. * * @return void */ public function test_get() { $testee = new Testee(); $action = 'action'; $name = 'name'; /** @var Context $context */ $context = Mockery::mock('Inpsyde\\Nonces\\Context')->shouldReceive('get_action')->andReturn($action)->shouldReceive('get_name')->andReturn($name)->getMock(); $nonce_field = 'nonce_field'; Monkey\Functions::expect('wp_nonce_field')->with($action, $name, false, false)->andReturn($nonce_field); $this->assertSame($nonce_field, $testee->get($context)); }
/** * Test for the get() method. * * @return void */ public function test_get() { $testee = new Testee(); $action = 'action'; $name = 'name'; Monkey\Functions::when('sanitize_title_with_dashes')->returnArg(); $context = new Context($action, $name); $nonce_field = 'nonce_field'; Monkey\Functions::expect('wp_nonce_field')->with($action, $name, false, false)->andReturn($nonce_field); $this->assertSame($nonce_field, $testee->get($context)); }