Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added PHPUnit setup

  • Loading branch information...
commit 5d6abcf4da1050f2bfd7181d7df9e8dc4b5c8228 1 parent a7f360a
William Durand willdurand authored
26 phpunit.xml.dist
View
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<phpunit backupGlobals="false"
+ backupStaticAttributes="false"
+ colors="true"
+ convertErrorsToExceptions="true"
+ convertNoticesToExceptions="true"
+ convertWarningsToExceptions="true"
+ processIsolation="false"
+ stopOnFailure="false"
+ syntaxCheck="false"
+ bootstrap="tests/bootstrap.php"
+ >
+ <testsuites>
+ <testsuite name="EqualNestBehavior Test Suite">
+ <directory>./tests/</directory>
+ </testsuite>
+ </testsuites>
+ <filter>
+ <whitelist>
+ <directory>./src/</directory>
+ <exclude>
+ <directory>./src/templates/</directory>
+ </exclude>
+ </whitelist>
+ </filter>
+</phpunit>
19 tests/EqualNestBehaviorTest.php
View
@@ -0,0 +1,19 @@
+<?php
+
+/**
+ * @author William Durand <william.durand1@gmail.com>
+ */
+class EqualNestBehaviorTest extends TestCase
+{
+ protected function setUp()
+ {
+ if (!class_exists('')) {
+ $schema = <<<XML
+<database name="equal_nest_behavior">
+</database>
+XML;
+ }
+
+ $this->getBuilder($schema)->build();
+ }
+}
27 tests/TestCase.php
View
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * @author William Durand <william.durand1@gmail.com>
+ */
+class TestCase extends \PHPUnit_Framework_TestCase
+{
+ public function assertSQLContains($tablename, $options, $expected)
+ {
+ $schema = $this->generateSchema($tablename, $options);
+ $builder = $this->getBuilder($schema);
+
+ $this->assertContains($expected, $builder->getSQL());
+ }
+
+ protected function getBuilder($schema)
+ {
+ $builder = new PropelQuickBuilder();
+ $config = $builder->getConfig();
+ $config->setBuildProperty('behavior.publishable.class', __DIR__ . '/../src/EqualNestBehavior');
+
+ $builder->setConfig($config);
+ $builder->setSchema($schema);
+
+ return $builder;
+ }
+}
7 tests/bootstrap.php
View
@@ -0,0 +1,7 @@
+<?php
+
+$loader = require_once __DIR__ . '/../vendor/autoload.php';
+$loader->add('', __DIR__ . '/../vendor/propel/propel1/generator/lib/util/PropelQuickBuilder.php');
+$loader->add('', __DIR__);
+
+set_include_path(__DIR__ . '/../vendor/phing/phing/classes' . PATH_SEPARATOR . get_include_path());
Please sign in to comment.
Something went wrong with that request. Please try again.