<commit_before><?php

namespace Octokit\Test\Client;

use Octokit\Client;

class UsersTest extends \PHPUnit_Framework_TestCase
{
    public $client;
    
    public function setUp()
    {
        $this->client = new Client(array('login' => 'sferik'));
    }
    
    public function tearDown()
    {
        $this->client->configuration->reset();
    }
    
    public function request()
    {
        return $this->client->request;
    }
    
    public function users()
    {
        return $this->client->users();
    }
    
    public function testSearchUsers()
    {
        $this->request()->setFixture('legacy/users');
        
        $users = $this->users()->searchUsers('sferik');
        
        $this->assertEquals($users[0]['login'], 'sferik');
    }
    
    public function testAllUsers()
    {
        $this->request()->setFixture('all_users');
        
        $users = $this->users()->allUsers();
        
        $this->assertEquals($users[0]['login'], 'mojombo');
    }
    
    public function testUserWithUsername()
    {
        $this->request()->setFixture('user');
        
        $user = $this->users()->user('sferik');
        
        $this->assertEquals($user['login'], 'sferik');
    }
    
    public function testUserWithoutUsername()
    {
        $this->request()->setFixture('user');
        
        $user = $this->users()->user();
        
        $this->assertEquals($user['login'], 'sferik');
    }
    
    public function testAccessToken()
    {
        $this->request()->setFixture('user_token');
        
        $access_token = $this->users()->accessToken('code', 'id_here', 'secret_here');
        
        $this->assertEquals($access_token['access_token'], 'this_be_ye_token/use_it_wisely');
    }
    
    public function testValidateCredentials()
    {
        $this->request()->setFixture('user');
        
        $valid = $this->users()->validateCredentials(array(
            'login'    => 'sferik',
            'password' => '<PASSWORD>',
        ));
        
        $this->assertTrue($valid);
    }
    
    public function testUpdateUser()
    {
        $this->request()->setFixture('user');
        
        $user = $this->users()->updateUser(array(
            'body' => array(
                'name'     => '<NAME>',
                'email'    => '<EMAIL>',
                'company'  => 'Code for America',
                'location' => 'San Francisco',
                'hireable' => false,
            ),
        ));
        
        $this->assertEquals($user['login'], 'sferik');
    }
    
    public function testFollowersWithUsername()
    {
        $this->request()->setFixture('followers');
        
        $followers = $this->users()->followers('sferik');
        
        $this->assertEquals($followers[0]['login'], 'puls');
    }
    
    public function testFollowersWithoutUsername()
    {
        $this->request()->setFixture('followers');
        
        $followers = $this->users()->followers();
        
        $this->assertEquals($followers[0]['login'], 'puls');<commit_msg>Fixed update user test<commit_after><?php

namespace Octokit\Test\Client;

use Octokit\Client;

class UsersTest extends \PHPUnit_Framework_TestCase
{
    public $client;
    
    public function setUp()
    {
        $this->client = new Client(array('login' => 'sferik'));
    }
    
    public function tearDown()
    {
        $this->client->configuration->reset();
    }
    
    public function request()
    {
        return $this->client->request;
    }
    
    public function users()
    {
        return $this->client->users();
    }
    
    public function testSearchUsers()
    {
        $this->request()->setFixture('legacy/users');
        
        $users = $this->users()->searchUsers('sferik');
        
        $this->assertEquals($users[0]['login'], 'sferik');
    }
    
    public function testAllUsers()
    {
        $this->request()->setFixture('all_users');
        
        $users = $this->users()->allUsers();
        
        $this->assertEquals($users[0]['login'], 'mojombo');
    }
    
    public function testUserWithUsername()
    {
        $this->request()->setFixture('user');
        
        $user = $this->users()->user('sferik');
        
        $this->assertEquals($user['login'], 'sferik');
    }
    
    public function testUserWithoutUsername()
    {
        $this->request()->setFixture('user');
        
        $user = $this->users()->user();
        
        $this->assertEquals($user['login'], 'sferik');
    }
    
    public function testAccessToken()
    {
        $this->request()->setFixture('user_token');
        
        $access_token = $this->users()->accessToken('code', 'id_here', 'secret_here');
        
        $this->assertEquals($access_token['access_token'], 'this_be_ye_token/use_it_wisely');
    }
    
    public function testValidateCredentials()
    {
        $this->request()->setFixture('user');
        
        $valid = $this->users()->validateCredentials(array(
            'login'    => 'sferik',
            'password' => '<PASSWORD>',
        ));
        
        $this->assertTrue($valid);
    }
    
    public function testUpdateUser()
    {
        $this->request()->setFixture('user');
        
        $user = $this->users()->updateUser(array(
            'name'     => '<NAME>',
            'email'    => '<EMAIL>',
            'company'  => 'Code for America',
            'location' => 'San Francisco',
            'hireable' => false,
        ));
        
        $this->assertEquals($user['login'], 'sferik');
    }
    
    public function testFollowersWithUsername()
    {
        $this->request()->setFixture('followers');
        
        $followers = $this->users()->followers('sferik');
        
        $this->assertEquals($followers[0]['login'], 'puls');
    }
    
    public function testFollowersWithoutUsername()
    {
        $this->request()->setFixture('followers');
        
        $followers = $this->users()->followers();
        
        $this->assertEquals($followers[0]['login'], 'puls');
{'fraction_non_alphanumeric': 0.1728578504210005, 'fraction_numerical': 0.0013207858675912169, 'mean_word_length': 2.038114343029087, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 132, 'https://': 0, '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': '5381058', 'n_tokens_mistral': 1732, 'n_tokens_neox': 1742, 'n_words': 248}