Permalink
Browse files

Doing couple of scenario cycles about our entity

$> vim behat.yml
We've enabled page showing in extension for more output
$> bin/behat --no-paths admissions/student_enrols_on_a_course.feature:6
We've ran scenario and it sais "No Bossa entity namespace"
$> vim app/config/config.yml
So we're adding configuration to the config.yml
$> bin/behat --no-paths admissions/student_enrols_on_a_course.feature:6
We're running scenario again to discover "Directory does not exist"
$> mkdir src/Bossa/Entity
So we've created it
$> bin/behat --no-paths admissions/student_enrols_on_a_course.feature:6
And then scenario started to complain about "No class"
$> bin/phpspec describe Bossa/Entity/Course
So we've described it
$> bin/phpspec run
And checked it. PHPSpec2 was nice enough to generate class for us
$> bin/behat --no-paths admissions/student_enrols_on_a_course.feature:6
Then Doctrine2 inside scenario, started to complain that there's no mapping
$> vim spec/Bossa/Entity/Course.php
So we've added entity mapping
$> bin/behat --no-paths admissions/student_enrols_on_a_course.feature:6
Then, scenario said "No primary key"
$> vim spec/Bossa/Entity/Course.php
So we've added getter for property and property example into spec
$> bin/phpspec run
And PHPSpec2 again was nice enough to generate method for us.
$> vim spec/Bossa/Entity/Course.php
We just needed to add property and its mapping.
$> bin/behat --no-paths admissions/student_enrols_on_a_course.feature:6
And we checked that we have no-Doctrine2 exception now

We're going couple of scenario exception cycles to completely get rid
of Doctrine exceptions. This is called "Change the message or make it
green".
  • Loading branch information...
1 parent dbda4ad commit 6cc34f1cbf656ccc72e38279d77d17271b9233ad @everzet committed Sep 14, 2012
Showing with 50 additions and 0 deletions.
  1. +7 −0 app/config/config.yml
  2. +2 −0 behat.yml
  3. +18 −0 spec/Bossa/Entity/Course.php
  4. +23 −0 src/Bossa/Entity/Course.php
@@ -49,6 +49,13 @@ doctrine:
orm:
auto_generate_proxy_classes: %kernel.debug%
auto_mapping: true
+ mappings:
+ Bossa:
+ type: annotation
+ is_bundle: false
+ dir: %kernel.root_dir%/../src/Bossa/Entity
+ prefix: Bossa\Entity\
+ alias: Bossa
# Swiftmailer Configuration
swiftmailer:
View
@@ -2,5 +2,7 @@ default:
extensions:
Behat\MinkExtension\Extension:
default_session: symfony2
+ show_cmd: open %s
+ show_auto: true
Behat\Symfony2Extension\Extension:
bundle: @BossaTrainingBundle
@@ -0,0 +1,18 @@
+<?php
+
+namespace spec\Bossa\Entity;
+
+use PHPSpec2\Specification;
+
+class Course implements Specification
+{
+ function it_should_exist()
+ {
+ $this->object->shouldNotBe(null);
+ }
+
+ function it_should_have_primary_key_which_is_null()
+ {
+ $this->course->getId()->shouldReturn(null);
+ }
+}
@@ -0,0 +1,23 @@
+<?php
+
+namespace Bossa\Entity;
+
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * @ORM\Entity
+ */
+class Course
+{
+ /**
+ * @ORM\Id
+ * @ORM\Column(type="integer")
+ * @ORM\GeneratedValue(strategy="AUTO")
+ */
+ private $id;
+
+ public function getId()
+ {
+ return $this->id;
+ }
+}

0 comments on commit 6cc34f1

Please sign in to comment.