Is there script for testing any kind of a php file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sidhx
    New Member
    • Dec 2009
    • 50

    Is there script for testing any kind of a php file?

    hi

    I wanted to develop php unit file testing. Like showing each php file with "test" link (or button).When we click the "test" associated to that file it dispay the output. plz help
  • code green
    Recognized Expert Top Contributor
    • Mar 2007
    • 1726

    #2
    I may be missing something but I would say no.
    The reason being it is a pointless exercise
    unless all your php code,html DAL etc is bundled into one file.

    And that is poor programming style

    Comment

    • sidhx
      New Member
      • Dec 2009
      • 50

      #3
      OK but is it possible to get xml content from the php file which has xml inside the php, while testing

      Comment

      • code green
        Recognized Expert Top Contributor
        • Mar 2007
        • 1726

        #4
        This again sounds like poor practice.
        Why would you have XML buried in PHP code?
        If you are reading or writing XML then ideally you should be using DOM or simpleXML.
        OK, I can understand writing XML as a string, interspersed with variables.
        Are you are tring to test this for valid XML?

        Comment

        • sidhx
          New Member
          • Dec 2009
          • 50

          #5
          Are you are tring to test this for valid XML?
          yes

          Comment

          • kovik
            Recognized Expert Top Contributor
            • Jun 2007
            • 1044

            #6
            It may be more useful if you give us an example of what you are trying to accomplish. There is no general way to "just test" in PHP.

            Comment

            • code green
              Recognized Expert Top Contributor
              • Mar 2007
              • 1726

              #7
              I would write the string variable to a text file using file_put_conten ts(), saving the file as .xml.
              Then the operation becomes validating an XML for being well formed.

              Comment

              • sidhx
                New Member
                • Dec 2009
                • 50

                #8
                i would like check the php files by sending details to respective file like post and get method type with only one click associated to that files.

                ex:
                authenticate.ph p----TEST
                gameStatus.php----TEST and soon

                Comment

                • kovik
                  Recognized Expert Top Contributor
                  • Jun 2007
                  • 1044

                  #9
                  You can utilize cURL to simulate POST and GET requests.

                  Comment

                  • sidhx
                    New Member
                    • Dec 2009
                    • 50

                    #10
                    Thanks for all cya

                    Comment

                    Working...