CrastyCrap's avatar

Laravel Test

Greeting everyone, I am working on an e-commerce project this project contains multi-store accordingly to reach any store you have to call route /store_name and this store name i want to make a test to check that all store pages work fine so i make simple test to do that work


public function store_main_test()
    {
        $stores = DB::table('stores')->where('activate',1)->pluck('name')->toArray();

        foreach( $stores as  $store ) {
            dump($store );

            $single_store = strtolower($store);

            $this->get("/$single_store");

            $this->assertTrue(true);

        }

        
    }

the problem here is that I only get the first store only what I am doing wrong here

0 likes
2 replies
Nakov's avatar

Is this supposed to be a test? Where do you create the stores? You know there are different databases used for testing?

CrastyCrap's avatar

@Nakov the stores have crud on their own and stored their name in DB want i am doing here is to get their value from the database ( in my case i don't have to use :memory: database as I only want to test the stores that I have in my real database) and check that they are working some time missing values cause some errors so i want to check that no store contain missing values i hope u understand me

Please or to participate in this conversation.