<commit_before><?php

/**
 * Flightstats tests
 *
 * @author     <NAME> <https://github.com/bvrignaud>
 * @license    MIT License
 * @link       https://github.com/bvrignaud/ci-flightstats
 */
class Flightstats_test extends TestCase
{
    public function setUp()
    {
        $this->obj = new FlightstatsApi();
    }
    
    public function test_getScheduleDepartureByFlightNumber()
    {
        $flight = $this->obj->getScheduleDepartureByFlightNumber('AF', '3321', new DateTime('2017-08-31'));
        $this->assertInstanceOf('ScheduledFlight', $flight);
        $this->assertEquals($flight->departureAirportFsCode, $flight->departureAirport->fs);
        $this->assertEquals($flight->arrivalAirportFsCode, $flight->arrivalAirport->fs);
    }
    
    public function test_extractDataFromFlightNumber()
    {
        $data = FlightstatsApi::extractDataFromFlightNumber('AF3321');
        $this->assertEquals(['carrier' => 'AF', 'flightnumber' => '3321'], $data);
        
        $data = FlightstatsApi::extractDataFromFlightNumber('UA54');
        $this->assertEquals(['carrier' => 'UA', 'flightnumber' => '54'], $data);
        
        $data = FlightstatsApi::extractDataFromFlightNumber('JAF3685');
        $this->assertEquals(['carrier' => 'JAF', 'flightnumber' => '3685'], $data);
        
        $data = FlightstatsApi::extractDataFromFlightNumber('AF8');
        $this->assertEquals(['carrier' => 'AF', 'flightnumber' => '8'], $data);
        
        $data = FlightstatsApi::extractDataFromFlightNumber('A53056');
        $this->assertEquals(['carrier' => 'A5', 'flightnumber' => '3056'], $data);
    }
    
    public function test_getDuration()
    {
        $flight = $this->obj->getScheduleDepartureByFlightNumber('AF', '7', new DateTime('2017-06-18'));
        $this->assertEquals('7h 25m', $flight->getDuration()->format('%hh %im'));
    }
}
<commit_msg>Add new test : test_getAirportByFsCode()<commit_after><?php

/**
 * Flightstats tests
 *
 * @author     <NAME> <https://github.com/bvrignaud>
 * @license    MIT License
 * @link       https://github.com/bvrignaud/ci-flightstats
 */
class Flightstats_test extends TestCase
{
    public function setUp()
    {
        $this->obj = new FlightstatsApi();
    }
    
    public function test_getScheduleDepartureByFlightNumber()
    {
        $flight = $this->obj->getScheduleDepartureByFlightNumber('AF', '3321', new DateTime('2017-08-31'));
        $this->assertInstanceOf('ScheduledFlight', $flight);
        $this->assertEquals($flight->departureAirportFsCode, $flight->departureAirport->fs);
        $this->assertEquals($flight->arrivalAirportFsCode, $flight->arrivalAirport->fs);
    }
    
    public function test_extractDataFromFlightNumber()
    {
        $data = FlightstatsApi::extractDataFromFlightNumber('AF3321');
        $this->assertEquals(['carrier' => 'AF', 'flightnumber' => '3321'], $data);
        
        $data = FlightstatsApi::extractDataFromFlightNumber('UA54');
        $this->assertEquals(['carrier' => 'UA', 'flightnumber' => '54'], $data);
        
        $data = FlightstatsApi::extractDataFromFlightNumber('JAF3685');
        $this->assertEquals(['carrier' => 'JAF', 'flightnumber' => '3685'], $data);
        
        $data = FlightstatsApi::extractDataFromFlightNumber('AF8');
        $this->assertEquals(['carrier' => 'AF', 'flightnumber' => '8'], $data);
        
        $data = FlightstatsApi::extractDataFromFlightNumber('A53056');
        $this->assertEquals(['carrier' => 'A5', 'flightnumber' => '3056'], $data);
    }
    
    public function test_getDuration()
    {
        $flight = $this->obj->getScheduleDepartureByFlightNumber('AF', '7', new DateTime('2017-08-18'));
        $this->assertEquals('7h 25m', $flight->getDuration()->format('%hh %im'));
    }

    public function test_getAirportByFsCode()
    {
        $airport = $this->obj->getAirportByFsCode('PDX');
        $this->assertEquals('PDX', $airport->fs);
    }
}

{'fraction_non_alphanumeric': 0.17266734279918863, 'fraction_numerical': 0.028397565922920892, 'mean_word_length': 3.513729977116705, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 75, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '805128', 'n_tokens_mistral': 1309, 'n_tokens_neox': 1202, 'n_words': 180}