PHP Classes

File: tests/DetectLanguageTest.php

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Multilingual Support Library   tests/DetectLanguageTest.php   Download  
File: tests/DetectLanguageTest.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Multilingual Support Library
Translate texts for Web sites from JSON or DB
Author: By
Last change:
Date: 3 years ago
Size: 1,266 bytes
 

Contents

Class file image Download
<?php


use PHPUnit\Framework\TestCase;
use
PHPtricks\Logaty\Helpers\Detect;

class
DetectLanguageTest extends TestCase
{
   
/** @test */
   
public function detect_property_is_instance_of_detect_class()
    {
       
$this->assertInstanceOf(Detect::class, logaty()->detect);
    }

   
/**
     * this test need (detect_country_lang) in config/options.php to be true to pass
     */
    /** @test */
   
public function we_can_detect_browser_language()
    {
       
$browserLang = logaty()->detect('browser');
       
$this->assertEquals($browserLang, 'ar');
    }

   
/**
     * this test need (detect_browser_lang) in config/options.php to be true to pass
     */
    /** @test */
   
public function we_can_detect_country_language()
    {
       
$countryLang = logaty()->detect('country');
       
$this->assertEquals($countryLang, 'ar');
    }

   
/**
     * this test need (detect_browser_lang && detect_country_lang)
     * in config/options.php to be true to pass
     */
    /** @test */
   
public function we_can_detect_language_as_we_configure_that()
    {
       
$langs = logaty()->detect();

       
$this->assertIsArray($langs);
       
$this->assertEquals($langs['browser'], 'ar');
       
$this->assertEquals($langs['country'], 'ar');
    }
}