18 $account->attributes = $attributes;
19 $this->assertTrue($account->save());
28 unset($attributes[
'data']);
30 $this->assertNotNull($account);
31 $this->assertTrue(is_array($account->data));
40 unset($attributes[
'data']);
41 $this->assertEquals(1,
Account::model()->deleteAllByAttributes($attributes));
44 public function testCreateFromService()
46 $service_id =
'12451gsd';
47 $service = $this->getMock(
'GoogleService', array(
'getId',
'fetchAttributes'));
48 $service->expects($this->any())
50 ->will($this->returnValue($service_id));
52 $account = Account::create($service);
53 $this->assertInstanceOf(
'Account', $account);
54 $this->assertEquals($service_id, $account->service_id);
55 $this->assertEquals($service->serviceName, $account->service);
60 public function provider()
65 'service' =>
'google',
66 'service_id' =>
'asd?d3rasd',
67 'data' => array(
'key' =>
'val')
71 'service' =>
'yandex',
72 'service_id' =>
'asfafsfafasd?d3rasd',
73 'data' => array(
'key' =>
'val')
77 'service' =>
'google',
78 'service_id' =>
'asd?d3r235235asd',
79 'data' => array(
'key' =>
'val')
82 'service' =>
'yandex',
83 'service_id' =>
'asfewfqd?d3rasd',
84 'data' => array(
'key' =>
'val')