TestGlobalFunctions

Contents

  • Methods

  • Source Source

    File: tests/test-global-functions.php

    class TestGlobalFunctions extends WP_UnitTestCase {
        
        /**
         * NOT FOUND integrations should return false.
         */
        public function test_automator_integration_exists_should_return_false() {
    
            $integration = automator_integration_exists("THIS_INTEGRATION_SHOULD_NOT_EXISTS");
    
            $this->assertFalse( $integration );
    
        }
    
        /**
         * Default integrations should return true
         * <file>./tests/src/global-functions.php</file>
         */
        public function test_automator_integration_exists_should_return_true() {
    
            $default_integrations = array(
                'WP',
                'UA',
                'ZAPIER',
                'INTEGROMAT',
                'TWITTER',
            );
    
            foreach ( $default_integrations as $integration ) {
                $integration = automator_integration_exists("WP");
                $this->assertTrue( $integration );
            }
            
        }
    
        public function test_automator_integration_exists_should_return_false_on_invalid_arguments() {
    
           // This should return false.
            $integration = automator_integration_exists( "" );
            $this->assertFalse( $integration );
    
        }
    
        public function test_automator_get_integration_by_name() {
    
            // Should match the value.
            $this->assertSame("wp", automator_get_integration_by_name("WP") );
    
            // Should match blank value if integration doesn't exists.
            $this->assertSame("", automator_get_integration_by_name("THIS-INTEGRATION-DOESNT-EXISTS") );
    
             // Should match blank value if integration doesn't exists.
             // this should return true or match.
             $this->assertSame("wp", automator_get_integration_by_name("WORDPRESS") );
        }
        
    }

    Methods Methods