diff --git a/.travis.yml b/.travis.yml index f28e63f0a8..605b44c156 100755 --- a/.travis.yml +++ b/.travis.yml @@ -33,8 +33,8 @@ before_script: # omitting "script:" will default to phpunit # use the $DB env variable to determine the phpunit.xml to use -# script: ./vendor/bin/codecept run -script: phpunit +script: ./vendor/bin/codecept run +#script: phpunit # configure notifications (email, IRC, campfire etc) notifications: diff --git a/composer.json b/composer.json index 7af5444a05..dc8a7996ed 100755 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "app/models", "app/database/migrations", "app/database/seeds", - "app/tests/TestCase.php" + "tests/unit/TestCase.php" ] }, "scripts": { diff --git a/phpunit.xml b/phpunit.xml index c330420569..16066a1f85 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,7 +1,6 @@ + + + - - ./app/tests/ + + tests/unit/ diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml index 913c3e51ec..2a280b9238 100644 --- a/tests/unit.suite.yml +++ b/tests/unit.suite.yml @@ -6,7 +6,4 @@ modules: enabled: - Asserts - \Helper\Unit - - Laravel4: - filters: true - cleanup: true - environment: testing + diff --git a/tests/unit/AssetTest.php b/tests/unit/AssetTest.php new file mode 100644 index 0000000000..2e830c238b --- /dev/null +++ b/tests/unit/AssetTest.php @@ -0,0 +1,21 @@ +name="test 1"; + $f->format="IP"; + $f->element="text"; + + $f->save(); + + $this->assertFalse($f->check_format("300.2.3.4")); + } + + + +} diff --git a/tests/unit/TestCase.php b/tests/unit/TestCase.php new file mode 100644 index 0000000000..c376e44d37 --- /dev/null +++ b/tests/unit/TestCase.php @@ -0,0 +1,39 @@ +prepareForTests(); + } + + + /** + * Creates the application. + * + * @return Symfony\Component\HttpKernel\HttpKernelInterface + */ + public function createApplication() + { + $unitTesting = true; + $testEnvironment = 'testing'; + return require __DIR__.'/../../bootstrap/start.php'; + } + + /** + * Migrates the database and set the mailer to 'pretend'. + * This will cause the tests to run quickly. + * + */ + private function prepareForTests() + { + Artisan::call('migrate', array('--package' => 'cartalyst/sentry')); + Artisan::call('migrate'); + } + +} diff --git a/tests/unit/UserTest.php b/tests/unit/UserTest.php deleted file mode 100644 index a5358e4e8f..0000000000 --- a/tests/unit/UserTest.php +++ /dev/null @@ -1,34 +0,0 @@ -email = "name@example.com"; - $user->password = "password"; - $user->setHasher(new Cartalyst\Sentry\Hashing\BCryptHasher); - - - // User should not save - $this->assertFalse($user->save()); - - // Save the errors - $errors = $user->errors()->all(); - - // There should be 1 error - $this->assertCount(1, $errors); - - // The username error should be set - $this->assertEquals($errors[0], "The username field is required."); - } - */ - - - -}