From 1f7e0a2893c05432a3c71ecc6fb8a00dec9d6268 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 12 Aug 2015 23:37:37 -0700 Subject: [PATCH] Revert "More donking with testing" This reverts commit 7f3ceea77b30fc36d11a09ed6bb241843d8e8221. # Conflicts: # .travis.yml --- .travis.yml | 2 +- composer.json | 2 +- phpunit.xml | 8 +++----- tests/unit.suite.yml | 5 ++++- tests/unit/AssetTest.php | 21 --------------------- tests/unit/TestCase.php | 39 --------------------------------------- tests/unit/UserTest.php | 34 ++++++++++++++++++++++++++++++++++ 7 files changed, 43 insertions(+), 68 deletions(-) delete mode 100644 tests/unit/AssetTest.php delete mode 100644 tests/unit/TestCase.php create mode 100644 tests/unit/UserTest.php diff --git a/.travis.yml b/.travis.yml index 3201a06a42..f28e63f0a8 100755 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ 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: ./vendor/bin/codecept run script: phpunit # configure notifications (email, IRC, campfire etc) diff --git a/composer.json b/composer.json index dc8a7996ed..7af5444a05 100755 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "app/models", "app/database/migrations", "app/database/seeds", - "tests/unit/TestCase.php" + "app/tests/TestCase.php" ] }, "scripts": { diff --git a/phpunit.xml b/phpunit.xml index 16066a1f85..c330420569 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,7 @@ - - - - - tests/unit/ + + ./app/tests/ diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml index 2a280b9238..913c3e51ec 100644 --- a/tests/unit.suite.yml +++ b/tests/unit.suite.yml @@ -6,4 +6,7 @@ modules: enabled: - Asserts - \Helper\Unit - + - Laravel4: + filters: true + cleanup: true + environment: testing diff --git a/tests/unit/AssetTest.php b/tests/unit/AssetTest.php deleted file mode 100644 index 2e830c238b..0000000000 --- a/tests/unit/AssetTest.php +++ /dev/null @@ -1,21 +0,0 @@ -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 deleted file mode 100644 index c376e44d37..0000000000 --- a/tests/unit/TestCase.php +++ /dev/null @@ -1,39 +0,0 @@ -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 new file mode 100644 index 0000000000..a5358e4e8f --- /dev/null +++ b/tests/unit/UserTest.php @@ -0,0 +1,34 @@ +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."); + } + */ + + + +}