|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +clean=1 # Clean up? |
| 4 | +gpg --fingerprint D8406D0D82947747293778314AA394086372C20A |
| 5 | +if [ $? -ne 0 ]; then |
| 6 | + echo -e "\033[33mDownloading PGP Public Key...\033[0m" |
| 7 | + gpg --recv-keys D8406D0D82947747293778314AA394086372C20A |
| 8 | + # Sebastian Bergmann <sb@sebastian-bergmann.de> |
| 9 | + gpg --fingerprint D8406D0D82947747293778314AA394086372C20A |
| 10 | + if [ $? -ne 0 ]; then |
| 11 | + echo -e "\033[31mCould not download PGP public key for verification\033[0m" |
| 12 | + exit |
| 13 | + fi |
| 14 | +fi |
| 15 | +if [ "$clean" -eq 1 ]; then |
| 16 | + # Let's clean them up, if they exist |
| 17 | + if [ -f phpunit.phar ]; then |
| 18 | + rm -f phpunit.phar |
| 19 | + fi |
| 20 | + if [ -f phpunit.phar.asc ]; then |
| 21 | + rm -f phpunit.phar.asc |
| 22 | + fi |
| 23 | +fi |
| 24 | + |
| 25 | +# Let's grab the latest release and its signature |
| 26 | +if [ ! -f phpunit.phar ]; then |
| 27 | + wget https://phar.phpunit.de/phpunit.phar |
| 28 | +fi |
| 29 | +if [ ! -f phpunit.phar.asc ]; then |
| 30 | + wget https://phar.phpunit.de/phpunit.phar.asc |
| 31 | +fi |
| 32 | + |
| 33 | +# Verify before running |
| 34 | +gpg --verify phpunit.phar.asc phpunit.phar |
| 35 | +if [ $? -eq 0 ]; then |
| 36 | + echo |
| 37 | + echo -e "\033[33mBegin Unit Testing\033[0m" |
| 38 | + # Run the testing suite |
| 39 | + php phpunit.phar --bootstrap autoload.php tests |
| 40 | + # Cleanup |
| 41 | + if [ "$clean" -eq 1 ]; then |
| 42 | + echo -e "\033[32mCleaning Up!\033[0m" |
| 43 | + rm -f phpunit.phar |
| 44 | + rm -f phpunit.phar.asc |
| 45 | + fi |
| 46 | +else |
| 47 | + echo |
| 48 | + chmod -x phpunit.phar |
| 49 | + mv phpunit.phar /tmp/bad-phpunit.phar |
| 50 | + mv phpunit.phar.asc /tmp/bad-phpunit.phar.asc |
| 51 | + echo -e "\033[31mSignature did not match! Check /tmp/bad-phpunit.phar for trojans\033[0m" |
| 52 | + exit 1 |
| 53 | +fi |
| 54 | + |
| 55 | +# The MIT License (MIT) |
| 56 | +# |
| 57 | +# Copyright (c) 2015 Resonant Core, LLC |
| 58 | +# |
| 59 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 60 | +# of this software and associated documentation files (the "Software"), to deal |
| 61 | +# in the Software without restriction, including without limitation the rights |
| 62 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 63 | +# copies of the Software, and to permit persons to whom the Software is |
| 64 | +# furnished to do so, subject to the following conditions: |
| 65 | +# |
| 66 | +# The above copyright notice and this permission notice shall be included in all |
| 67 | +# copies or substantial portions of the Software. |
| 68 | +# |
| 69 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 70 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 71 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 72 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 73 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 74 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 75 | +# SOFTWARE. |
0 commit comments