/** * Test for the create() method. * * @return void */ public function test_create() { $testee = new Testee(); $action = 'action'; /** @var Context $context */ $context = Mockery::mock('Inpsyde\\Nonces\\Context')->shouldReceive('get_action')->andReturn($action)->getMock(); Monkey\Functions::expect('wp_create_nonce')->with($action); $this->assertInstanceOf('Inpsyde\\Nonces\\Nonce', $testee->create($context)); }
/** * Test for the create() method. * * @return void */ public function test_create() { $testee = new Testee(); $action = 'action'; Monkey\Functions::when('sanitize_title_with_dashes'); $context = new Context($action); $nonce_value = 'nonce'; Monkey\Functions::expect('wp_create_nonce')->with($action)->andReturn($nonce_value); $nonce = $testee->create($context); $this->assertSame($nonce_value, $nonce->get()); }