files = [ 'en.php' => ' "and the Philosopher\'s Stone"];', 'en_ca.php' => ' "{0} and {1}"];', 'en_us.php' => ' "and the Sorcerer\'s Stone"];', 'fr.php' => ' "à l\'école des sorciers"];', 'ja.php' => ' "賢者の石"];', 'de.php' => ' "und der Stein der Weisen"];', 'pt_br.php' => ' "e a Pedra Filosofal"];', // corrupted message in valid file 'vi.php' => ' "{0} and {1"];', // corrupt files 'it.php' => ' ' 'DEAD BEEF', 'fr_ca.php' => '', // unreadable file 'ru.php' => '', ]; $vfs = vfsStream::setup("langtest", 0777, $this->files); $this->path = $vfs->url()."/"; // set up a file without read access chmod($this->path."ru.php", 0000); // make the test Lang class use the vfs files $this->l = new Lang($this->path); // create a mock Lang object to keep exceptions from creating loops $this->clearData(false); $m = $this->getMockBuilder(Lang::class)->setMethods(['__invoke'])->getMock(); $m->expects($this->any())->method("__invoke")->with($this->anything(), $this->anything())->will($this->returnValue("")); Data::$l = $m; // call the additional setup method if it exists if(method_exists($this, "setUpSeries")) $this->setUpSeries(); } function tearDown() { $this->clearData(true); // call the additional teardiwn method if it exists if(method_exists($this, "tearDownSeries")) $this->tearDownSeries(); } }