Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A project is born...
# If you use Zend Studio or Eclipse PDT create a new
# `PHP Project` named ZfBugs in your workspace
# workspace could easily be in /usr/local/zend/apache2/htdocs
# if you utilize Zend Server the location is up to you
cd ~/${Workspace}
zf create project ZendDb
# create the build structure, build.xml and build container
touch ZendDb/build.xml
# edit the build.xml
mkdir ZendDb/build
cd ZendDb/build
touch phpcs.xml phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="ZendDb" default="build" basedir=".">
<property name="source" value="." />
<target name="clean" description="Clean up and create report directories">
<!-- This will clear previous files and directories, then create
them for the next run -->
<delete dir="${basedir}/build/api" />
<delete dir="${basedir}/build/coverage" />
<delete dir="${basedir}/build/logs" />
<mkdir dir="${basedir}/build/api" />
<mkdir dir="${basedir}/build/coverage" />
<mkdir dir="${basedir}/build/logs" />
<touch file="${basedir}/build/logs/codeSniffer.txt" />
</target>
<target name="phpunit" description="Run PHPUnit">
<exec executable="phpunit" failonerror="true">
<arg line="-c ${basedir}/build/phpunit.xml" />
</exec>
</target>
<target name="phpcs" description="Generate codeSniffer.txt using PHP_CodeSniffer">
<exec executable="phpcs">
<arg
line="--report=full
--report-file=${basedir}/build/logs/codeSniffer.txt
--standard=${basedir}/build/phpcs.xml
${basedir}" />
</exec>
</target>
<target name="phpdoc" description="Generate API documentation using PHPDocumentor">
<exec executable="phpdoc">
<arg line="-d ${source} -t ${basedir}/build/api" />
</exec>
</target>
<target name="build" depends="clean,phpunit,phpcs,phpdoc" />
</project>
#edit the phpcs.xml<?xml version="1.0"?>
<ruleset name="Zend Standard">
<description>Zend Standard, exclude extraneous</description>
<exclude-pattern>*/tests/*</exclude-pattern>
<exclude-pattern>*/db/*</exclude-pattern>
<exclude-pattern>*.js</exclude-pattern>
<exclude-pattern>*.css</exclude-pattern>
<rule ref="Zend" />
</ruleset>
<phpunit bootstrap="../tests/bootstrap.php">
<testsuite name="ZendDb Test Suite">
<directory>../tests/application</directory>
</testsuite>
<testsuite name="ZendDb Test Suite">
<directory>../tests/library</directory>
</testsuite>
<logging>
<log type="coverage-html" target="coverage" title="ZendDb"
charset="UTF-8" yui="true" highlight="true" lowUpperBound="35"
highLowerBound="70" />
</logging>
<filter>
<whitelist>
<directory suffix=".php">library/</directory>
</whitelist>
</filter>
</phpunit>
#discover all relevant channels
sudo pear channel-discover pear.zfcampus.org/
sudo pear channel-discover pear.phpunit.de
sudo pear channel-discover components.ez.no
sudo pear channel-discover pear.symfony-project.com
# install required/desired packages
sudo pear install PHPDocumentor
sudo pear install PHP_CodeSniffer
sudo pear install --alldeps phpunit/PHPUnit
sudo pear install --alldeps zfcampus/ZF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.