Permalink
Browse files

Updating library to use Composer in dev-mode also

Updates Travis support
Removed unneeded bootstrap and class loaders
Updated README
Moved phpunit.xml to root
  • Loading branch information...
1 parent 05d2e1b commit 682823f28ea3f182b08e5a73a2716cdb4b0f689b @rdohms committed Apr 19, 2012
Showing with 95 additions and 115 deletions.
  1. +6 −2 .gitignore
  2. +0 −12 .gitmodules
  3. +7 −5 .travis.yml
  4. +13 −1 README.md
  5. +5 −3 composer.json
  6. +29 −0 phpunit.xml
  7. +29 −29 tests/DMS/Filter/FilterTest.php
  8. +6 −8 tests/Tests/Testcase.php
  9. +0 −23 tests/bootstrap.php
  10. +0 −30 tests/phpunit.xml
  11. +0 −1 vendors/Symfony/Component/ClassLoader
  12. +0 −1 vendors/doctrine-common
View
@@ -1,5 +1,9 @@
.DS_Store
+.idea/
+
tests/_reports/*
-/_build/
+_build/
_distribution
-.idea/
+
+vendor/
+composer.lock
View
@@ -1,12 +0,0 @@
-[submodule "vendors/doctrine2"]
- path = vendors/doctrine2
- url = git://github.com/doctrine/doctrine2.git
-[submodule "vendors/Symfony/Components/ClassLoader"]
- path = vendors/Symfony/Components/ClassLoader
- url = https://github.com/symfony/ClassLoader.git
-[submodule "vendors/Symfony/Component/ClassLoader"]
- path = vendors/Symfony/Component/ClassLoader
- url = https://github.com/symfony/ClassLoader.git
-[submodule "vendors/doctrine-common"]
- path = vendors/doctrine-common
- url = https://github.com/doctrine/common.git
View
@@ -1,9 +1,11 @@
language: php
+
php:
- - 5.3
- - 5.4
+ - 5.3
+ - 5.4
-before_script:
- - git submodule update --init
+before_script:
+ - curl -s http://getcomposer.org/installer | php
+ - php composer.phar --dev install
-script: phpunit --configuration tests/phpunit.xml
+script: phpunit
View
@@ -2,8 +2,20 @@
The objective of this repository is to consolidate various components I carry around with me in various systems and to offer some of them as standalone libraries, like Filter.
+Status: [![Build Status](https://secure.travis-ci.org/rdohms/DMS.png?branch=master)](http://travis-ci.org/rdohms/DMS)
+
# Components
## Filter
-The filter library is a standalone annotation based filter library for entities, it works very well alongside Symfony's Validator library.
+The filter library is a standalone annotation based filter library for entities, it works very well alongside Symfony's Validator library.
+
+## Bundles
+
+### Filter Bundle
+
+Implements DMS\Filter in Symfony 2
+
+### Launcher Bundle (pre-alpha)
+
+Allows you to run a pre-release campaign on your site and gather users before launching.
View
@@ -1,7 +1,7 @@
{
"name": "dms/dms",
"type": "library",
- "description": "DMS Library, includes varied bundles and components.",
+ "description": "DMS Library, includes various bundles and components.",
"keywords": ["symfony", "dms", "standalone"],
"homepage": "https://github.com/rdohms/DMS",
"license": "MIT",
@@ -14,12 +14,14 @@
],
"require": {
- "php": ">=5.3.2"
+ "php": ">=5.3.2",
+ "doctrine/common": ">=2.1"
},
"autoload": {
"psr-0": {
- "DMS": "src/"
+ "DMS": "src/",
+ "Tests": "tests/"
}
},
View
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<phpunit bootstrap="vendor/.composer/autoload.php" colors="true" verbose="true">
+
+ <testsuites>
+ <testsuite name="DMS Suite">
+ <directory>tests/DMS</directory>
+ </testsuite>
+ <testsuite name="Filter">
+ <directory>tests/DMS/Filter</directory>
+ </testsuite>
+ </testsuites>
+
+ <filter>
+ <whitelist>
+ <directory suffix=".php">src/DMS/Filter</directory>
+ </whitelist>
+ <blacklist>
+ <directory>tests</directory>
+ <directory>vendor</directory>
+ <directory>src/DMS/Bundles</directory>
+ </blacklist>
+ </filter>
+
+ <logging>
+ <log type="coverage-html" target="tests/_reports/coverage/" charset="UTF-8" yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/>
+ <log type="testdox-text" target="tests/_reports/testdox/tests.txt"/>
+ <log type="testdox-html" target="tests/_reports/testdox/tests.html"/>
+ </logging>
+</phpunit>
@@ -7,111 +7,111 @@
class FilterTest extends \Tests\Testcase
{
/**
- * @var DMS\Filter\Filter
+ * @var \DMS\Filter\Filter
*/
protected $filter;
-
+
public function setUp()
{
parent::setUp();
-
+
$this->filter = new Filter($this->buildMetadataFactory());
}
-
+
public function tearDown()
{
parent::tearDown();
}
-
+
public function testFilter()
{
$class = new Dummy\Classes\AnnotatedClass();
$class->name = "Sir Isaac<script></script> Newton";
$class->nickname = "justaname";
$class->description = "This is <b>an apple</b>. <p>Isn't it?</p>";
-
+
$classClone = clone $class;
-
+
$this->filter->filterEntity($class);
-
+
$this->assertNotEquals($classClone->name, $class->name);
$this->assertEquals($classClone->nickname, $class->nickname);
$this->assertNotEquals($classClone->description, $class->description);
-
+
$this->assertNotContains("<script>", $class->name);
$this->assertNotContains("<p>", $class->description);
}
-
+
public function testFilterWithParent()
{
$class = new Dummy\Classes\ChildAnnotatedClass();
$class->name = "Sir Isaac<script></script> Newton";
$class->nickname = "justaname";
$class->description = "This is <b>an apple</b>. <p>Isn't it?</p>";
$class->surname = " Surname";
-
+
$classClone = clone $class;
-
+
$this->filter->filterEntity($class);
-
+
$this->assertNotEquals($classClone->name, $class->name);
$this->assertEquals($classClone->nickname, $class->nickname);
$this->assertNotEquals($classClone->description, $class->description);
$this->assertNotEquals($classClone->surname, $class->surname);
-
+
$this->assertNotContains("<script>", $class->name);
$this->assertNotContains("<p>", $class->description);
$this->assertNotContains(" ", $class->surname);
}
-
+
public function testFilterProperty()
{
$class = new Dummy\Classes\AnnotatedClass();
$class->name = "Sir Isaac<script></script> Newton";
$class->description = "This is <b>an apple</b>. <p>Isn't it?</p>";
-
+
$classClone = clone $class;
-
+
$this->filter->filterProperty($class, 'description');
-
+
$this->assertEquals($classClone->name, $class->name);
$this->assertNotEquals($classClone->description, $class->description);
-
+
$this->assertContains("<script>", $class->name);
$this->assertNotContains("<p>", $class->description);
}
-
+
public function testFilterValue()
{
$value = "this is <b> a string<p> with<b> tags</p> and malformed";
-
+
$filtered = $this->filter->filterValue($value, new Rules\StripTags());
-
+
$this->assertNotEquals($value, $filtered);
-
+
$this->assertNotContains('<b>', $filtered);
$this->assertNotContains('<p>', $filtered);
}
-
+
public function testFilterValueWithArray()
{
$value = "this is <b> a string<p> with<b> tags</p> and\n malformed";
-
+
$filters = array(new Rules\StripTags(), new Rules\StripNewlines());
$filtered = $this->filter->filterValue($value, $filters);
-
+
$this->assertNotEquals($value, $filtered);
-
+
$this->assertNotContains('<b>', $filtered);
$this->assertNotContains('<p>', $filtered);
$this->assertNotContains('\n', $filtered);
}
-
+
public function testNotFailOnNull()
{
$this->filter->filterEntity(null);
}
-
+
public function testGetMetadataFactory()
{
$this->assertInstanceOf('DMS\Filter\Mapping\ClassMetadataFactory', $this->filter->getMetadataFactory());
@@ -7,29 +7,27 @@
class Testcase extends \PHPUnit_Framework_TestCase
{
-
protected $loader;
-
+
public function setUp()
{
parent::setUp();
}
-
+
public function tearDown()
{
parent::tearDown();
}
-
+
protected function buildMetadataFactory()
{
$reader = new Annotations\AnnotationReader();
- $reader->setEnableParsePhpImports(true);
-
+
$loader = new Mapping\Loader\AnnotationLoader($reader);
$this->loader = $loader;
-
+
$metadataFactory = new Mapping\ClassMetadataFactory($loader);
-
+
return $metadataFactory;
}
}
View
@@ -1,23 +0,0 @@
-<?php
-
-use Symfony\Component\ClassLoader\UniversalClassLoader;
-
-define('ROOT_DIR', __DIR__ . '/..');
-define('VENDOR_DIR', __DIR__ . '/../vendors');
-
-require VENDOR_DIR . '/Symfony/Component/ClassLoader/UniversalClassLoader.php';
-
-//Add autoloader
-$loader = new UniversalClassLoader();
-
-$loader->registerNamespaces(array(
- 'Symfony\Component' =>
- array(VENDOR_DIR . '/Symfony',
- VENDOR_DIR . '/doctrine2/lib/vendor/Symfony'),
- 'Doctrine' => array(VENDOR_DIR . '/doctrine-common/lib'),
- 'DMS' => array(ROOT_DIR . '/src', ROOT_DIR . 'tests'),
- 'Tests' => ROOT_DIR . '/tests',
-));
-
-
-$loader->register();
View
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<phpunit bootstrap="bootstrap.php" colors="true" verbose="true">
-
- <testsuites>
- <testsuite name="DMS Suite">
- <directory>DMS</directory>
- </testsuite>
- <testsuite name="Filter">
- <directory>DMS/Filter</directory>
- </testsuite>
- </testsuites>
-
- <filter>
-
- <whitelist>
- <directory suffix=".php">../src/DMS/Filter</directory>
- </whitelist>
- <blacklist>
- <directory>../tests</directory>
- <directory>../vendors</directory>
- <directory>../src/DMS/Bundles</directory>
- </blacklist>
- </filter>
-
- <logging>
- <log type="coverage-html" target="_reports/coverage/" charset="UTF-8" yui="true" highlight="false" lowUpperBound="35" highLowerBound="70"/>
- <log type="testdox-text" target="_reports/testdox/tests.txt"/>
- <log type="testdox-html" target="_reports/testdox/tests.html"/>
- </logging>
-</phpunit>
Submodule ClassLoader deleted from 6894a1
Submodule doctrine-common deleted from c614a2

0 comments on commit 682823f

Please sign in to comment.