Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test cases and post build hook #24

Closed
rhcarvalho opened this issue Feb 23, 2016 · 0 comments
Closed

Add test cases and post build hook #24

rhcarvalho opened this issue Feb 23, 2016 · 0 comments

Comments

@rhcarvalho
Copy link
Contributor

💠 Adding a test case to the existing app didn't seen like the most fun and useful thing to do right now, so I'm opening this issue as a remainder to myself later or kind request for help if someone else wants to contribute sample unit tests.

This patch adds a build hook to run tests as part of the build flow in OpenShift:

diff --git a/openshift/templates/cakephp-mysql.json b/openshift/templates/cakephp-mysql.json
index 52143da..c1140b0 100644
--- a/openshift/templates/cakephp-mysql.json
+++ b/openshift/templates/cakephp-mysql.json
@@ -106,7 +106,10 @@
               "secret": "${GITHUB_WEBHOOK_SECRET}"
             }
           }
-        ]
+        ],
+        "postCommit": {
+          "script": "./Console/cake test"
+        }
       }
     },
     {
diff --git a/openshift/templates/cakephp.json b/openshift/templates/cakephp.json
index b77dc0c..dae89ff 100644
--- a/openshift/templates/cakephp.json
+++ b/openshift/templates/cakephp.json
@@ -31,7 +31,7 @@
           }
         ],
         "selector": {
-          "name": "cakephp-example" 
+          "name": "cakephp-example"
         }
       }
     },
@@ -106,7 +106,10 @@
               "secret": "${GITHUB_WEBHOOK_SECRET}"
             }
           }
-        ]
+        ],
+        "postCommit": {
+          "script": "./Console/cake test"
+        }
       }
     },
     {

Note: ./Console/cake test might need extra arguments. See http://book.cakephp.org/2.0/en/development/testing.html (since apparently we're using 2.x as of now).

It might be even just cake test, but we need phpunit installed. I tried to make at least the build hook working and leave actual tests for later, but I'm giving up trying to make it work for now 💦

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants