Skip to content

Commit

Permalink
[10.x] Make fake instance inherit from Vite when using `withoutVite…
Browse files Browse the repository at this point in the history
…()` (#49150)

* Extend from `Vite`

* Fix tests
  • Loading branch information
orkhanahmadov authored Nov 28, 2023
1 parent 9a65168 commit 2865eba
Showing 1 changed file with 19 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ protected function withoutVite()

Facade::clearResolvedInstance(Vite::class);

$this->swap(Vite::class, new class
$this->swap(Vite::class, new class extends Vite
{
public function __invoke()
public function __invoke($entrypoints, $buildDirectory = null)
{
return '';
}

public function __call($name, $arguments)
public function __call($method, $parameters)
{
return '';
}
Expand All @@ -130,32 +130,32 @@ public function __toString()
return '';
}

public function useIntegrityKey()
public function useIntegrityKey($key)
{
return $this;
}

public function useBuildDirectory()
public function useBuildDirectory($path)
{
return $this;
}

public function useHotFile()
public function useHotFile($path)
{
return $this;
}

public function withEntryPoints()
public function withEntryPoints($entryPoints)
{
return $this;
}

public function useScriptTagAttributes()
public function useScriptTagAttributes($attributes)
{
return $this;
}

public function useStyleTagAttributes()
public function useStyleTagAttributes($attributes)
{
return $this;
}
Expand All @@ -164,6 +164,16 @@ public function preloadedAssets()
{
return [];
}

public function reactRefresh()
{
return '';
}

public function asset($asset, $buildDirectory = null)
{
return '';
}
});

return $this;
Expand Down

0 comments on commit 2865eba

Please sign in to comment.