Skip to content

Commit 76d5225

Browse files
Merge pull request #140 from symfony-cmf/testing_scripts
Testing scripts
2 parents 61d0396 + 9f3af65 commit 76d5225

File tree

6 files changed

+94
-1
lines changed

6 files changed

+94
-1
lines changed

bin/make/functional_tests_orm.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
functional_tests_orm:
3+
@if [ "${CONSOLE}" = "" ]; then echo "Console executable missing"; exit 1; fi
4+
@echo
5+
@echo '+++ create ORM database +++'
6+
@${CONSOLE} doctrine:schema:drop --env=orm --force
7+
@${CONSOLE} doctrine:database:create --env=orm
8+
@${CONSOLE} doctrine:schema:create --env=orm
9+
@echo '+++ run ORM functional tests +++'
10+
@vendor/bin/simple-phpunit --testsuite "functional tests with orm"
11+
@${CONSOLE} doctrine:database:drop --force

bin/make/functional_tests_phpcr.mk

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
functional_tests_phpcr:
3+
@if [ "${CONSOLE}" = "" ]; then echo "Console executable missing"; exit 1; fi
4+
@echo
5+
@echo '+++ create PHPCR +++'
6+
@${CONSOLE} doctrine:phpcr:init:dbal --drop --force
7+
@${CONSOLE} doctrine:phpcr:repository:init
8+
@echo '+++ run PHPCR functional tests +++'
9+
@vendor/bin/simple-phpunit --testsuite "functional tests with phpcr"
10+
@${CONSOLE} doctrine:database:drop --force

bin/make/test_installation.mk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
test_installation:
3+
@if [ "${PACKAGE}" = "" ] || [ "${VERSION}" = "" ]; then echo "Package name or version missing"; exit 1; fi
4+
@echo
5+
@echo '+++ testing installation into a blank symfony application +++'
6+
vendor/symfony-cmf/testing/bin/scripts/check_install.sh -p${PACKAGE} -v${VERSION}

bin/make/unit_tests.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
unit_tests:
3+
@echo
4+
@echo '+++ run unit tests +++'
5+
@vendor/bin/simple-phpunit --testsuite "unit tests"

bin/scripts/check_install.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env bash
2+
3+
usage="$(basename "$0") [-hl] [-t] -- Script to test a bundle installation with on a symfony application.
4+
where:
5+
-h show help text
6+
-p The complete package name of the bundle;"
7+
8+
BASE_DIR=${PWD}
9+
BUILD_DIR=${BASE_DIR}/build
10+
11+
PACKAGE_NAME=''
12+
VERSION='dev-master'
13+
14+
function installBundle() {
15+
DIR=${BUILD_DIR}/${PACKAGE_NAME}/${VERSION}
16+
17+
mkdir -p ${DIR}
18+
echo "Create directory ${DIR}"
19+
cd ${DIR}
20+
echo "+++ Create Symfony skeleton app +++ "
21+
composer create-project "symfony/skeleton:^3.3" test-app
22+
cd test-app/
23+
composer config extra.symfony.allow-contrib true
24+
if [ "${VERSION}" = "dev"* ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi
25+
REQUIRE=${PACKAGE_NAME}":"${VERSION}
26+
echo "+++ Require bundle ${REQUIRE} +++"
27+
composer req -n "${REQUIRE}"
28+
OUT=$?
29+
if [ ${OUT} -eq 0 ];then
30+
echo "+++ Install is fine +++"
31+
exit 0
32+
else
33+
echo "+++ Problems to install package +++"
34+
exit ${OUT}
35+
fi
36+
echo $?
37+
echo "+++ We should fetch composer exit code here +++"
38+
}
39+
40+
while getopts :hv:p: option
41+
do
42+
case "${option}"
43+
in
44+
p) PACKAGE_NAME=${OPTARG};;
45+
v) VERSION=${OPTARG};;
46+
h) echo "${usage}"
47+
exit 1
48+
;;
49+
:) printf "missing argument for -%s\n" "$OPTARG" >&2
50+
echo "$usage" >&2
51+
exit 1
52+
;;
53+
\?) printf "illegal option: -%s\n" "$OPTARG" >&2
54+
echo "$usage" >&2
55+
exit 1
56+
;;
57+
esac
58+
done
59+
60+
installBundle
61+

phpunit.xml.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
>
88

99
<testsuites>
10-
<testsuite name="Symfony CmfMenuBundle Test Suite">
10+
<testsuite name="Symfony Testing Component Test Suite">
1111
<directory>./tests</directory>
1212
</testsuite>
1313
</testsuites>

0 commit comments

Comments
 (0)