Giter VIP home page Giter VIP logo

auth-tests's People

Contributors

benyou1969 avatar dczajkowski avatar nhedger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

auth-tests's Issues

Remember Me won't work when Invalidating Sessions On Other Devices

Environment

  • Laravel Version: 5.8.7
  • PHP Version: 7.3

Description:

For starters there's no test for Invalidating Sessions On Other Devices and since that changes the password hash on the cookie, the remember me test becomes a failing test.

Also, we shouldn't be using the bcrypt helper anymore, since i think argon2id will become the default once php 7.1 is no longer supported, which should be this December.

Steps To Reproduce:

1.- Fresh Laravel Install
2.- Add Invalidating Sessions On Other Devices Functionality
3.- Test

Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9

Environment

  • Laravel Version: 5.8.17
  • PHP Version: 7.3.1
  • PHPUnit Version: 8.1.5

Description:


There was 1 warning:

1) Tests\Feature\Auth\LoginTest::testUserCannotMakeMoreThanFiveAttemptsInOneMinute
Using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. Refactor your test to use assertStringContainsString() or assertStringContainsStr
ingIgnoringCase() instead.

Steps To Reproduce:

Simply run the tests

Testing "remember me" functionality?

Environment

  • Laravel Version: 5.6.16
  • PHP Version: 7.2

Description:

Any plans to add tests for "remember me" functionality?

Steps To Reproduce:

None

Laravel 5.6

Environment

  • Laravel Version: 5.6
  • PHP Version: 7

Description:

Can we get a release for laravel 5.6?

When installing in a laravel 5.6 project composer pulls in version 5.5.4 of your lib, which doesnt have all the flags.

Tests failing for guest redirect due to a recent change in Laravel

Environment

  • Laravel Version: 6.4.0
  • PHP Version: 7.3

Description:

Two tests are failing because the guest middleware for ResetPasswordController.php and ForgotPasswordController.php was removed in a recent version of Laravel. See this commit.

There were 2 failures:

1) Tests\Feature\Auth\ForgotPasswordTest::testUserCannotViewAnEmailPasswordFormWhenAuthenticated
Response status code [200] is not a redirect status code.
Failed asserting that false is true.

/playground-testing-stuff/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:198
/Applications/MAMP/htdocs/playground-testing-stuff/tests/Feature/Auth/ForgotPasswordTest.php:51

2) Tests\Feature\Auth\ResetPasswordTest::testUserCannotViewAPasswordResetFormWhenAuthenticated
Response status code [200] is not a redirect status code.
Failed asserting that false is true.

/playground-testing-stuff/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:198
/Applications/MAMP/htdocs/playground-testing-stuff/tests/Feature/Auth/ResetPasswordTest.php:64

Random failed test results

Getting some really weird issues with this.. My test results are failing randomly. Sometimes none fail, sometimes two.. sometimes three? Examples:

1) Tests\Feature\Auth\ForgotPasswordTest::testUserReceivesAnEmailWithAPasswordResetLink
Failed asserting that null is not null.

..xxx/tests/Feature/Auth/ForgotPasswordTest.php:66
2) Tests\Feature\Auth\LoginTest::testUserCanLoginWithCorrectCredentials
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'http://localhost/dashboard'
+'http://localhost'

...xxx/vendor/laravel/framework/src/Illuminate/Foundation/Testing/TestResponse.php:96
...xxx/tests/Feature/Auth/LoginTest.php:72

Note my home is really 'dashboard' now, dashboard is behind auth (part of web,auth middleware) - could this be it?

Any ideas?

Laravel 5.7

Environment

  • Laravel Version: 5.7.2
  • PHP Version: 7.2.9

Description:

Can we get a release for laravel 5.7 and test the new Email Verification thingy?

Update auth tests to be used on laravel 5.9

Environment

  • Laravel Version: 5.9.1
  • PHP Version: 7.2

Description:

Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package laravel/framework 5.9.* is satisfiable by laravel/framework[5.9.x-dev] but these conflict with your requirements or minimum-stability.
Problem 2
- The requested package laravel/framework (locked at v5.8.13, required as 5.9.*) is satisfiable by laravel/framework[v5.8.13] but these conflict with your requirements or minimum-stability.
Problem 3
- dczajkowski/auth-tests 5.8.1 requires laravel/framework ~5.8 -> satisfiable by laravel/framework[5.8.x-dev, 5.9.x-dev, v5.8.0, v5.8.1, v5.8.10, v5.8.11, v5.8.12, v5.8.13, v5.8.2, v5.8.3, v5.8.4, v5.8.5, v5.8.6, v5.8.7, v5.8.8, v5.8.9] but these conflict with your requirements or minimum-stability.
- dczajkowski/auth-tests 5.8 requires laravel/framework ~5.8 -> satisfiable by laravel/framework[5.8.x-dev, 5.9.x-dev, v5.8.0, v5.8.1, v5.8.10, v5.8.11, v5.8.12, v5.8.13, v5.8.2, v5.8.3, v5.8.4, v5.8.5, v5.8.6, v5.8.7, v5.8.8, v5.8.9] but these conflict with your requirements or minimum-stability.
- Installation request for dczajkowski/auth-tests ^5.8 -> satisfiable by dczajkowski/auth-tests[5.8, 5.8.1].

βœ• user sees the verification notice when not verified

Environment

  • Laravel Version: 7.12.0
  • PHP Version: 7.4.6

Description:

$ php artisan test
  Warning: TTY mode is not supported on Windows platform.

   RUNS  Tests\Unit\ExampleTest
  β€’ basic test

  Tests:  44 pending

   PASS  Tests\Unit\ExampleTest
  βœ“ basic test

   RUNS  Tests\Feature\Auth\EmailVerificationTest
  β€’ guest cannot see the verification notice

  Tests:  1 passed, 43 pending

   RUNS  Tests\Feature\Auth\EmailVerificationTest
  β€’ user sees the verification notice when not verified

  Tests:  2 passed, 42 pending

   FAIL  Tests\Feature\Auth\EmailVerificationTest
  βœ“ guest cannot see the verification notice
  βœ• user sees the verification notice when not verified

  Tests:  1 failed, 2 passed, 41 pending

  The response is not a view.

  at E:\Websites\BBX\BBXCentral\vendor\phpunit\phpunit\src\Framework\Assert.php:3309
    3305|     public static function fail(string $message = ''): void
    3306|     {
    3307|         self::$count++;
    3308|
  > 3309|         throw new AssertionFailedError($message);
    3310|     }
    3311|
    3312|     /**
    3313|      * Returns the value of an attribute of a class or an object.

  1   E:\Websites\BBX\BBXCentral\vendor\laravel\framework\src\Illuminate\Testing\TestResponse.php:938
      PHPUnit\Framework\Assert::fail("The response is not a view.")

  2   E:\Websites\BBX\BBXCentral\vendor\laravel\framework\src\Illuminate\Testing\TestResponse.php:848
      Illuminate\Testing\TestResponse::ensureResponseHasView()

Steps To Reproduce:

Basically when testing my self manually when a user is not verified it takes you to the email verification route and works fine but for some reason the test fails and says the response is not a view.

All of my Auth routes are default and match what are in the tests.

The user model has MustVerifyEmail.

All the Auth stuff works at the moment when testing manually

PasswordReset issue

Environment

  • Laravel Version: 5.8.38
  • PHP Version: 7.3.10

Description:

I know I'm using an old laravel, this is a legacy project.
I've used this package previously and I found it really pleasurable.
Now I have an issue which bugs me for hours now and maybe you have an idea.

  1. Tests\Feature\Auth\ForgotPasswordTest::testUserReceivesAnEmailWithAPasswordResetLink
    Failed asserting that null is not null.
    This code snippet:
$user = factory(User::class)->create([
    'email' => '[email protected]',
]);
$this->post($this->passwordEmailPostRoute(), [
    'email' => '[email protected]',
]);
$this->assertNotNull($token = DB::table('password_resets')->first());

Steps To Reproduce:

The user gets written into the database, but for some reason, the provider can't return it, it always fetches null.
I dumped the data, the queries, everything seems to be fine, still, always null. Any idea?

Thank you!

assertRegExp() is deprecated and will be removed in PHPUnit 10

Environment

  • Laravel Version: 7.15.0
  • PHP Version: 7.4.5

Description:

When running the testUserCannotMakeMoreThanFiveAttemptsInOneMinute test, I see the following deprecation warning:

assertRegExp() is deprecated and will be removed in PHPUnit 10. Refactor your code to use assertMatchesRegularExpression() instead

Laravel 8 deprecation

Laravel 8 marked the laravel/ui package as deprecated in favor of Jetstream.

From what I can see, Jetstream hides all of its controllers inside the package, meaning it doesn't make sense to test those controllers, as Jetstream has its own tests.

From what I understand, using this package (and upgrading it to new releases) makes only sense for people already using the old authentication flow, who want to upgrade their existing projects. The question I have as a maintainer β€” is it worth it?

I am @'​ing a few people who have contributed/were active on/are watching this repo. Please let me know what you think. See #54 and the deprecation notice in particular to get a sense of what all of this means. :)

Have a good day,
Dariusz

cc: @drbyte @nhedger @benyou1969 @zaknesler @FaizAhmadSE @drehimself

Make testUserCannotMakeMoreThanFiveAttemptsInOneMinute Language agnostic

I want to suggest a small recomendation. My app is in spanish, so the texts are in spanish and the fallback locale is in english. So, the LoginTest natuarally fails:

There was 1 failure:

1) Tests\Feature\Auth\LoginTest::testUserCannotMakeMoreThanFiveAttemptsInOneMinute
Failed asserting that 'Demasiados intentos de acceso. Por favor intente nuevamente en 60 segundos.' contains "Too many login attempts.".

/home/vagrant/code/ce/tests/Feature/Auth/LoginTest.php:174

It can easily be solved forcing the app to be in english before executing the tests :)

    public function testUserCannotMakeMoreThanFiveAttemptsInOneMinute()
    {
        $this->app->setLocale('en');
        // ...

By the way, amazing package. I love it!

Incorrect assertion

Thanks for putting this together. saved me a lot of time.

Environment

  • Laravel Version: 5.7.

  • PHP Version: PHP 7.2.12-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov 12 2018 09:55:44) ( NTS )

Description:

testUserCannotVereifyOthers() fails on a correct redirect assertion

Steps To Reproduce:

 public function testUserCannotVerifyOthers()
    {
        $user = factory(User::class)->create([
            'id' => 1,
            'email_verified_at' => null,
        ]);

        $response = $this->actingAs($user)->get($this->validVerificationVerifyRoute(2));
        $response->assertRedirect($this->successfulVerificationRoute());
        // Should be ???
        // $response->assertForbidden();
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.