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 acceptance tests for home, search, login and create posts #115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
node_modules
bower_components
sitemap.xml

tests/_output/*
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,23 @@ It would be great if you could avoid tweeting me about it, because
I'm getting a little bit overwhelmed by the tweets and it's just
not a very productive way to report the bug.

## Developer Notes

### Testing

For testing we are using [codeception](http://codeception.com/) which provides access to create acceptance,
functional and unit tests.

To run the tests you will need to [download](http://selenium-release.storage.googleapis.com/index.html) and run
the selenium web driver, e.g.

java -jar ./selenium-server-standalone-2.45.0.jar

Then build and run the test suite

vendor/bin/codecept build
vendor/bin/codecept run

### Credits

- Thanks to <a href="https://twitter.com/daniel_sloof">Daniel Sloof</a> for the domain name - magehero.com!
Expand Down
46 changes: 26 additions & 20 deletions build/vm_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password passwor
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'

sudo apt-get install -y python-software-properties
sudo add-apt-repository ppa:l-mierzwa/lucid-php5
sudo add-apt-repository ppa:ondrej/php5-oldstable

sudo apt-get update

sudo apt-get install -y --force-yes curl apache2 libapache2-mod-fastcgi php5 php5-fpm php5-cli php5-curl php5-gd php5-mcrypt php5-mysql mysql-server
sudo apt-get install -y --force-yes curl apache2 libapache2-mod-fastcgi php5 php5-fpm php5-cli php5-curl php5-gd php5-mcrypt php5-mysql mysql-server git-core

sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/fpm/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/fpm/php.ini
Expand All @@ -28,32 +28,38 @@ EOF"

WEBROOT="/vagrant/"
sudo echo "<VirtualHost *:80>
DocumentRoot $WEBROOT

<Directory $WEBROOT>
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>

<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
# If you get an internal error, maybe try the line below instead of the one above
#FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization -idle-timeout 3600
</IfModule>
DocumentRoot $WEBROOT

<Directory $WEBROOT>
Options FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order deny,allow
Allow from all
</Directory>

<IfModule mod_fastcgi.c>
AddHandler php5-fcgi .php
Action php5-fcgi /php5-fcgi
Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -pass-header Authorization
# If you get an internal error, maybe try the line below instead of the one above
#FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization -idle-timeout 3600
</IfModule>

</VirtualHost>" | sudo tee /etc/apache2/sites-available/default > /dev/null

sudo service apache2 restart
sudo service php5-fpm restart

mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS magehero;"
cat $(find /vagrant/sql/ -type f | sort --version-sort) | mysql -uroot -proot magehero
# cat $(find /vagrant/sql/ -type f | sort --version-sort) | mysql -uroot -proot magehero

sudo bash -c "cat >> /etc/hosts <<EOF
127.0.0.1 magehero.local
EOF"

curl -sS https://getcomposer.org/installer | php
php composer.phar --working-dir=/vagrant/ install
wget http://mh.tomrobertshaw.net/magehero.lkn52na09235.sql.gz
zcat magehero.lkn52na09235.sql.gz | mysql -uroot -proot magehero
rm magehero.lkn52na09235.sql.gz
17 changes: 17 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
helpers: tests/_support
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"erusev/parsedown": "dev-master",
"ezyang/htmlpurifier": "dev-master",
"thepixeldeveloper/sitemap": "dev-master",
"symfony/console": "~2.6"
"symfony/console": "~2.6",
"codeception/codeception": "*"
},
"autoload": {"psr-0": {"": "code"}}
}
Loading