 pronamic    /
                    wp-pronamic-ideal
                      pronamic    /
                    wp-pronamic-ideal
                
                            | 1 | <?php | ||
| 2 | /** | ||
| 3 | * Version number test | ||
| 4 | * | ||
| 5 | * @author Pronamic <[email protected]> | ||
| 6 | * @copyright 2005-2019 Pronamic | ||
| 7 | * @license GPL-3.0-or-later | ||
| 8 | * @package Pronamic\WordPress\Pay | ||
| 9 | */ | ||
| 10 | |||
| 11 | namespace Pronamic\WordPress\Pay; | ||
| 12 | |||
| 13 | use WP_UnitTestCase; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * Version number test | ||
| 17 | * | ||
| 18 | * @author Remco Tolsma | ||
| 19 | * @version 1.0.0 | ||
| 20 | */ | ||
| 21 | class VersionNumberTest extends WP_UnitTestCase { | ||
| 22 | /** | ||
| 23 | * Setup version number test. | ||
| 24 | */ | ||
| 25 | 	public function setUp() { | ||
| 26 | parent::setUp(); | ||
| 27 | |||
| 28 | $this->plugin_dir = realpath( __DIR__ . '/../..' ); | ||
| 0 ignored issues–
                            show             Bug
            Best Practice
    
    
    
        introduced 
                            by  
  Loading history... | |||
| 29 | |||
| 30 | $this->package_file = $this->plugin_dir . '/package.json'; | ||
| 0 ignored issues–
                            show | |||
| 31 | $this->readme_file = $this->plugin_dir . '/readme.txt'; | ||
| 0 ignored issues–
                            show | |||
| 32 | $this->plugin_file = $this->plugin_dir . '/pronamic-ideal.php'; | ||
| 0 ignored issues–
                            show | |||
| 33 | |||
| 34 | $this->package = json_decode( file_get_contents( $this->package_file ) ); | ||
| 0 ignored issues–
                            show | |||
| 35 | } | ||
| 36 | |||
| 37 | /** | ||
| 38 | * Test readme.txt file for stable tag version number. | ||
| 39 | */ | ||
| 40 | 	public function test_readme_txt() { | ||
| 41 | $readme_txt_lines = file( $this->readme_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); | ||
| 42 | |||
| 43 | $search_string = sprintf( 'Stable tag: %s', $this->package->version ); | ||
| 44 | |||
| 45 | $this->assertContains( $search_string, $readme_txt_lines ); | ||
| 46 | } | ||
| 47 | |||
| 48 | /** | ||
| 49 | * Test plugin header for version number. | ||
| 50 | */ | ||
| 51 | 	public function test_plugin_header() { | ||
| 52 | $data = get_plugin_data( $this->plugin_file ); | ||
| 53 | |||
| 54 | $this->assertEquals( $this->package->version, $data['Version'] ); | ||
| 55 | } | ||
| 56 | |||
| 57 | /** | ||
| 58 | * Test plugin object for version number. | ||
| 59 | */ | ||
| 60 | 	public function test_plugin_version() { | ||
| 61 | $this->assertEquals( $this->package->version, pronamic_pay_plugin()->get_version() ); | ||
| 62 | } | ||
| 63 | } | ||
| 64 | 
