/** * Test for the render() method. * * @return void */ public function test_render() { $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(); $url = 'url'; $nonced_url = 'nonced_url'; Monkey\Functions::expect('wp_nonce_url')->with($url, $action, $name)->andReturn($nonced_url); $this->expectOutputString($nonced_url); $testee->render($url, $context); }
/** * 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); $url = 'url'; $nonced_url = 'nonced_url'; Monkey\Functions::expect('wp_nonce_url')->with($url, $action, $name)->andReturn($nonced_url); $this->expectOutputString($nonced_url); $testee->render('url', $context); }