diff --git a/console/migrations/m160406_133247_create_junction_portfolio_and_user.php b/console/migrations/m160406_133247_create_junction_portfolio_and_user.php
new file mode 100644
index 0000000..976a059
--- /dev/null
+++ b/console/migrations/m160406_133247_create_junction_portfolio_and_user.php
@@ -0,0 +1,57 @@
+createTable('portfolio_user', [
+ 'portfolio_user_id' => $this->primaryKey(),
+ 'portfolio_id' => $this->integer()
+ ->notNull(),
+ 'user_id' => $this->integer()
+ ->notNull(),
+ 'position' => $this->string(),
+ 'time' => $this->integer(),
+ 'status' => $this->integer()
+ ->defaultValue(2)
+ ->notNull(),
+ ]);
+
+ // add foreign key for table `portfolio`
+ $this->addForeignKey('fk-portfolio_user-portfolio_id', 'portfolio_user', 'portfolio_id', 'portfolio', 'portfolio_id', 'CASCADE');
+
+ // add foreign key for table `user`
+ $this->addForeignKey('fk-portfolio_user-user_id', 'portfolio_user', 'user_id', 'user', 'id', 'CASCADE');
+
+ $this->createIndex('unique_portfolio_user_key', 'portfolio_user', ['portfolio_id', 'user_id'], true);
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function down()
+ {
+
+ $this->dropIndex('unique_portfolio_user_key', 'portfolio_user');
+
+ // drops foreign key for table `portfolio`
+ $this->dropForeignKey('fk-portfolio_user-portfolio_id', 'portfolio_user');
+
+ // drops foreign key for table `user`
+ $this->dropForeignKey('fk-portfolio_user-user_id', 'portfolio_user');
+
+ $this->dropTable('portfolio_user');
+ }
+ }
diff --git a/frontend/views/accounts/_portfolio_form.php b/frontend/views/accounts/_portfolio_form.php
index da2ffcd..979c107 100644
--- a/frontend/views/accounts/_portfolio_form.php
+++ b/frontend/views/accounts/_portfolio_form.php
@@ -214,7 +214,7 @@
}
);
$.fancybox.open(
- {href : 'http://mfp.dev/ajax/project-user'}, {
+ {href : '/ajax/project-user'}, {
type : 'ajax', maxWidth : 750,
ajax : {dataType : 'html', data : {ids : JSON.stringify(ids)}},
tpl : {wrap : '
'}
diff --git a/frontend/web/images/tick.png b/frontend/web/images/tick.png
new file mode 100644
index 0000000..92466c1
Binary files /dev/null and b/frontend/web/images/tick.png differ
diff --git a/tests/_support/Step/Acceptance/CRMOperatorSteps.php b/tests/_support/Step/Acceptance/CRMOperatorSteps.php
new file mode 100644
index 0000000..926bd96
--- /dev/null
+++ b/tests/_support/Step/Acceptance/CRMOperatorSteps.php
@@ -0,0 +1,36 @@
+amOnPage('site/signup');
+ }
+
+ public function imagineCustomer(){
+ $fake = \Faker\Factory::create();
+ return [
+ 'SignupForm[username]' => $fake->name,
+ 'SignupForm[email]' => $fake->email,
+ 'SignupForm[password]' => $fake->password(19),
+ ];
+
+ }
+
+ public function fillCustomerDataForm($fieldData){
+ $I = $this;
+ foreach ($fieldData as $key=>$value) {
+ $I->fillField($key,$value);
+ }
+
+ }
+
+ public function submitCustomerDataForm(){
+ $I = $this;
+ $I->click('signup-button');
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/tests/config/.gitignore b/tests/config/.gitignore
new file mode 100644
index 0000000..20da318
--- /dev/null
+++ b/tests/config/.gitignore
@@ -0,0 +1,2 @@
+main-local.php
+params-local.php
\ No newline at end of file
diff --git a/tests/config/bootstrap.php b/tests/config/bootstrap.php
new file mode 100644
index 0000000..b3d9bbc
--- /dev/null
+++ b/tests/config/bootstrap.php
@@ -0,0 +1 @@
+ 'app-test',
+ 'basePath' => dirname(__DIR__),
+ 'bootstrap' => ['log'],
+];
diff --git a/tests/config/params.php b/tests/config/params.php
new file mode 100644
index 0000000..7f754b9
--- /dev/null
+++ b/tests/config/params.php
@@ -0,0 +1,4 @@
+ 'admin@example.com',
+];
diff --git a/tests/config/unit.php b/tests/config/unit.php
new file mode 100644
index 0000000..4a98b44
--- /dev/null
+++ b/tests/config/unit.php
@@ -0,0 +1,9 @@
+assertEquals($validator->validate($email), $result);
+ }
+
+ public function getEmailVariants(){
+ return [
+ ['test@test.com', true],
+ ['test@test', false],
+ ['testtest.com', false]
+ ];
+ }
+}
\ No newline at end of file
diff --git a/tests/unit/UserStoreTest.php b/tests/unit/UserStoreTest.php
new file mode 100644
index 0000000..0a4e142
--- /dev/null
+++ b/tests/unit/UserStoreTest.php
@@ -0,0 +1,54 @@
+store = new UserStore();
+ }
+
+ public function imagineCustomer(){
+ $fake = \Faker\Factory::create();
+ return [
+ 'name' => $fake->name,
+ 'email' => $fake->email,
+ 'pass' => $fake->password(19),
+ ];
+
+ }
+
+ public function testGetUser(){
+ $imagineUser = $this->imagineCustomer();
+ $this->store->addUser($imagineUser['name'],$imagineUser['email'],$imagineUser['pass']);
+ $user = $this->store->getUser($imagineUser['email']);
+ $this->assertEquals($user['name'], $imagineUser['name']);
+ $this->assertEquals($user['email'], $imagineUser['email']);
+ $this->assertEquals($user['pass'], $imagineUser['pass']);
+ }
+
+ public function testAddUser_ShortPass(){
+ $this->setExpectedException('\yii\base\Exception');
+ $this->store->addUser('Some Name','collmail@gig.com','ff');
+ }
+
+ protected function _after()
+ {
+ }
+
+ // tests
+// public function testMe()
+// {
+//
+// }
+}
\ No newline at end of file
diff --git a/tests/unit/ValidatorTest.php b/tests/unit/ValidatorTest.php
new file mode 100644
index 0000000..0505723
--- /dev/null
+++ b/tests/unit/ValidatorTest.php
@@ -0,0 +1,27 @@
+getMock('common\components\UserStore');
+ $this->validator = new Validator($store);
+ $store->expects($this->once())
+ ->method('notifyPasswordFailure')
+ ->with($this->equalTo("test@emails.com"));
+
+ $store->expects($this->any())
+ ->method("getUser")
+ ->will($this->returnValue([
+ "name"=>"fdsfdf",
+ "email"=>"test@emails.com",
+ "pass"=>"rihfhh"
+ ]));
+
+ $this->assertFalse($this->validator->validateUser("test@emails.com", "wrong"));
+ }
+}
\ No newline at end of file
--
libgit2 0.21.4