Add Segment data factory
[MAILPOET-1546]
This commit is contained in:
48
tests/DataFactories/Segment.php
Normal file
48
tests/DataFactories/Segment.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MailPoet\Test\DataFactories;
|
||||||
|
|
||||||
|
use Carbon\Carbon;
|
||||||
|
|
||||||
|
class Segment {
|
||||||
|
|
||||||
|
private $data;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
$this->data = [
|
||||||
|
'name' => 'List ' . uniqid(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $name
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withName($name) {
|
||||||
|
$this->data['name'] = $name;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $description
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withDescription($description) {
|
||||||
|
$this->data['description'] = $description;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withDeleted() {
|
||||||
|
$this->data['deleted_at'] = Carbon::now();
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @return \MailPoet\Models\Segment */
|
||||||
|
public function create() {
|
||||||
|
return \MailPoet\Models\Segment::createOrUpdate($this->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -76,4 +76,4 @@ class SubscriptionFormMultipleListsCest {
|
|||||||
$I->waitForText($subscriber_email);
|
$I->waitForText($subscriber_email);
|
||||||
$I->see('Subscribed', Locator::contains('tr', $subscriber_email));
|
$I->see('Subscribed', Locator::contains('tr', $subscriber_email));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user