Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 03 2018 02:56

    crynobone on 3.7

    Update core. Signed-off-by: Mi… (compare)

  • Sep 03 2018 02:55

    crynobone on 3.6

    Update core. Signed-off-by: Mi… (compare)

  • Aug 23 2018 07:20
    Okipa commented #226
  • Aug 23 2018 02:40

    crynobone on v3.7.0

    (compare)

  • Aug 23 2018 02:31

    crynobone on 3.7

    Prepare v3.7.0 release. Signed… (compare)

  • Aug 23 2018 02:25

    crynobone on 3.7

    Prepare v3.6.5 release. Signed… Update .gitignore. Signed-off-… Merge branch '3.6' into 3.7 Si… and 1 more (compare)

  • Aug 23 2018 00:12
    crynobone closed #225
  • Aug 22 2018 23:23
    crynobone commented #226
  • Aug 22 2018 23:17
    crynobone closed #226
  • Aug 22 2018 23:17
    crynobone commented #226
  • Aug 22 2018 16:25
    Okipa opened #226
  • Aug 22 2018 16:07
    Okipa commented #220
  • Aug 16 2018 12:33

    crynobone on 3.6

    Update .gitignore. Signed-off-… (compare)

  • Aug 13 2018 19:47
    Artistan commented #194
  • Aug 09 2018 13:18
    diegocaprioli commented #225
  • Aug 09 2018 13:17
    diegocaprioli commented #225
  • Aug 09 2018 13:16
    crynobone labeled #225
  • Aug 09 2018 13:16
    crynobone commented #225
  • Aug 09 2018 13:14
    diegocaprioli opened #225
  • Aug 06 2018 20:44

    crynobone on v3.6.5

    (compare)

Mior Muhammad Zaki
@crynobone
too many things to mock
it would be easier to separate the code to a class, and test that class.
Alexander Zhuravlev
@SCIF
Just i'm building orm adapter and need to test Auth user providers
Alexander Zhuravlev
@SCIF
@crynobone , thank you for explanation. Will try test it by separated pieces
Mior Muhammad Zaki
@crynobone
okay
Matt Lantz
@mlantz
Hey is there a way to run a vendor publish for the tests?
Mior Muhammad Zaki
@crynobone
$this->artisan('vendor:publish') etc?
Amo Chohan
@drawmyattention
I'm getting a really noobish error: Class 'Orchestra\Testbench\TestCase' not found , looks like an autoloading issue
Any ideas?
Using global phpunit, using vendor/bin/phpunit solves it! Ignore me
Talv
@talvbansal
anyone here?
Talv
@talvbansal

can anyone help my understand why my migrations aren't getting run, my testcase class looks like this

class TestCase extends \Orchestra\Testbench\TestCase
{
    /**
     * The base URL to use while testing the application.
     *
     * @var string
     */
    protected $baseUrl = 'http://localhost';

    use DatabaseMigrations;

    public function setUp()
    {
        parent::setUp();

        $this->artisan('migrate', [
            '--database' => 'testbench',
            '--realpath' => realpath(__DIR__.'/../database/factories'),
        ]);

        $this->withFactories( realpath( __DIR__ . '/../database/factories') );
    }


    /**
     * Define environment setup.
     *
     * @param  \Illuminate\Foundation\Application $app
     *
     * @return void
     */
    protected function getEnvironmentSetUp($app)
    {
        // Setup default database to use sqlite :memory:
        $app['config']->set('database.default', 'testbench');
        $app['config']->set('database.connections.testbench', [
            'driver'   => 'sqlite',
            'database' => ':memory:',
            'prefix'   => '',
            'strict'   => false
        ]);
    }

}

whenever i run phpunit i get the following error:

Illuminate\Database\QueryException: SQLSTATE[HY000]: General error: 1 no such table: users (SQL: insert into "users"...
Talv
@talvbansal
i fix the --realpath => part to say migrations not factories but thats not changed the output
Mior Muhammad Zaki
@crynobone
what output?
Jared Fraser
@jared-fraser
hi all, if I tell Testbench about my package provider, should it be calling boot() on my provider? I'm trying to test if configuration is loaded correctly but it doesn't seem to be calling boot
Jared Fraser
@jared-fraser
hmm ignore me, seems to be a version issue. dropped back to 3.2.* and its working now
Jared Fraser
@jared-fraser
actually think i'm having a problem with defer. is there a way to change defer to false just for tests?
Mior Muhammad Zaki
@crynobone
@jared-fraser if it doesn't work properly on tests, it has a possibility to not work on the production too.
changing the defer to false just for tests is just going to create more false positive tests.
Jared Fraser
@jared-fraser
yeah
i'm still trying to work it out
as soon as i defer TestBench isn't calling register or boot on my serviceprovider
Mior Muhammad Zaki
@crynobone
that the point of defer, unless you actually suppose to use eager
Jared Fraser
@jared-fraser
no the service i am creating is not needed all the time. so defer is the correct option. however trying to create tests with something defered isn't booting even when i ask for the service
i must be doing something wrong but i dont know what
Jared Fraser
@jared-fraser
laravel should call the register function if the service provider is deferred as it has to know what objects to use the callback of when required. but it's not called in testbench
Mior Muhammad Zaki
@crynobone
how did you ask the service to boot?
Jared Fraser
@jared-fraser
i registered the provider in the getPackageProviders
does that not tell testbench to boot that provider?
Mior Muhammad Zaki
@crynobone
that just registering the service
Jared Fraser
@jared-fraser
ok how do i boot the provider?
Mior Muhammad Zaki
@crynobone
if the service is deferred, testbench would respect that as if any of Laravel default service provider
such as ViewServiceProvider
registering is not booting!
Jared Fraser
@jared-fraser
i understand that, i'm just not sure on how to boot it
as when the laravel app initialises shouldn't it ask all the providers what their registered services are?
Mior Muhammad Zaki
@crynobone
you call the services such as you would with laravel.
app('view') = ...
^ when laravel receive the first request, only then it would boot ViewServiceProvider

as when the laravel app initialises shouldn't it ask all the providers what their registered services are?

we are doing the same booting process as Laravel would.

if you code doesn't work with testbench, it possible it may not work with laravel.
Jared Fraser
@jared-fraser
hmm ok thanks. i'll keep playing around
travoltron
@travoltron
having a hard time testing routes, getting 404s, because the routes aren't registered.
How to boot the app to give the routes a home?
baobazbarley
@baobazbarley
hello
Kazi Mainuddin Ahmed
@tzsk
How do I use Session in the tests
That session is getting set properly or not.
Alfred Nutile
@alnutile
what is the best way to test routes with orchestra/testbench
Jelle van Leeuwen
@jvleeuwen
how can i make http request with testbench-browser-kit? i cant find any docs about it.
Kristoffer Eklund
@eklundkristoffer

Hello! I have been trying to use testbench dusk, but I cannot get my head around how to set it up properly.

I currently have like
~/Sites/projects/testing (laravel 5.6 application http://testing.test)
~/Sites/packages/testing (loaded into the testing laravel application using composer)

So if i go to http://testing.test, everything looks good. So now I want to run the tests, i cd into ~/Sites/packages/testing and run composer install and then phpunit. But it is most likely wrong since it also seems to load my ~/Sites/projects/testing/.env file and i cannot overwrite the DB_DATABASE env.

What am I doing wrong? Thanks.

My ~/Sites/packages/testing/phpunit.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
     backupStaticAttributes="false"
     bootstrap="vendor/autoload.php"
     colors="true"
     convertErrorsToExceptions="true"
     convertNoticesToExceptions="true"
     convertWarningsToExceptions="true"
     processIsolation="false"
     stopOnFailure="false"
     syntaxCheck="false">
    <testsuites>
        <testsuite name="Browser">
            <directory suffix="Test.php">./tests/Browser</directory>
        </testsuite>
        <testsuite name="Unit">
            <directory suffix="Test.php">./tests/Unit</directory>
        </testsuite>
    </testsuites>
    <php>
        <env name="APP_KEY" value="base64:Xgs1LQt1GdVHhD6qyYCXnyq61DE3UKqJ5k2SJc+Nw2g="/>
        <env name="APP_ENV" value="testing"/>
        <env name="APP_URL" value="http://testing.test"/>
        <env name="CACHE_DRIVER" value="array"/>
        <env name="SESSION_DRIVER" value="array"/>
        <env name="QUEUE_DRIVER" value="sync"/>
        <env name="DB_CONNECTION" value="sqlite"/>
        <env name="DB_DATABASE" value=":memory:"/>
    </php>
    <filter>
        <whitelist addUncoveredFilesFromWhitelist="false">
            <directory suffix=".php">src/</directory>
        </whitelist>
    </filter>
</phpunit>