/** * Do custom initialization. */ public function setUp() { parent::setUp(); $this->product = $this->getMockBuilder('\\ITELIC\\Product')->disableOriginalConstructor()->getMock(); $this->product->ID = 1; $this->key = $this->getMockBuilder('\\ITELIC\\Key')->disableOriginalConstructor()->getMock(); $this->key->method('get_product')->willReturn($this->product); $this->activation = $this->getMockBuilder('\\ITELIC\\Activation')->disableOriginalConstructor()->getMock(); $this->activation->method('get_key')->willReturn($this->key); }
/** * Setup the object before each test. */ public function setUp() { parent::setUp(); $mock_activation = $this->getMockBuilder('\\ITELIC\\Activation')->disableOriginalConstructor()->getMock(); $mock_release = $this->getMockBuilder('\\ITELIC\\Release')->disableOriginalConstructor()->getMock(); $mock_release->method('get_version')->willReturn('1.2'); $mock_product = $this->getMockBuilder('\\ITELIC\\Product')->disableOriginalConstructor()->getMock(); $mock_product->ID = 1; $mock_product->post_title = 'Product Name'; $mock_product->method('get_latest_release_for_activation')->with($mock_activation)->willReturn($mock_release); $mock_product->method('get_changelog')->willReturn('Changes'); $mock_product->method('get_feature')->will($this->returnValueMap(array(array('description', array(), 'This is the description.'), array('licensing-readme', array(), array('author' => 'User1,User2', 'tested' => '4.4', 'requires' => '4.3', 'last_updated' => \ITELIC\make_date_time('2014-12-31'), 'banner_low' => 'www.example.com/low', 'banner_high' => 'www.example.com/high'))))); $mock_key = $this->getMockBuilder('\\ITELIC\\Key')->disableOriginalConstructor()->getMock(); $mock_key->method('get_product')->willReturn($mock_product); $this->key = $mock_key; $this->activation = $mock_activation; WP_Mock::wpFunction('ITELIC\\generate_download_link', array('times' => 1, 'args' => array($this->activation), 'return' => 'www.example.com/download')); WP_Mock::wpFunction('get_permalink', array('times' => 1, 'args' => array(1), 'return' => 'www.example.com/product/1')); }
/** * Do custom initialization. */ public function setUp() { parent::setUp(); $this->_toggle_global_renewal_discount(true); }