forked from Kyon147/laravel-shopify
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHomeControllerTest.php
44 lines (35 loc) · 1.36 KB
/
HomeControllerTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
namespace Osiset\ShopifyApp\Test\Traits;
use Illuminate\Auth\AuthManager;
use Osiset\ShopifyApp\Test\TestCase;
use Osiset\ShopifyApp\Util;
class HomeControllerTest extends TestCase
{
/**
* @var AuthManager
*/
protected $auth;
public function setUp(): void
{
parent::setUp();
$this->auth = $this->app->make(AuthManager::class);
}
public function testHomeRoute(): void
{
$shop = factory($this->model)->create(['name' => 'shop-name.myshopify.com']);
$host = base64_encode($shop->getDomain()->toNative().'/admin');
$this->call('get', '/', ['token' => $this->buildToken(), 'host' => $host])
->assertOk()
->assertSee('name="shopify-api-key" content="'.Util::getShopifyConfig('api_key').'"', false)
->assertSee('https://cdn.shopify.com/shopifycloud/app-bridge.js');
}
public function testHomeRouteHostAdmin(): void
{
factory($this->model)->create(['name' => 'shop-name.myshopify.com']);
$host = base64_encode('admin.shopify.com/store/shop-name');
$this->call('get', '/', ['token' => $this->buildToken(), 'host' => $host])
->assertOk()
->assertSee('name="shopify-api-key" content="'.Util::getShopifyConfig('api_key').'"', false)
->assertSee('https://cdn.shopify.com/shopifycloud/app-bridge.js');
}
}